From 00fbfefd12cc7e8792a091fd18baa2fdd1c13507 Mon Sep 17 00:00:00 2001 From: kliment Date: Mon, 28 Mar 2011 18:19:03 +0200 Subject: Changed initialization order to enable Mega 2560 users to connect more reliably --- Tonokip_Firmware/Tonokip_Firmware.pde | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'Tonokip_Firmware') diff --git a/Tonokip_Firmware/Tonokip_Firmware.pde b/Tonokip_Firmware/Tonokip_Firmware.pde index d64a50e..8168987 100644 --- a/Tonokip_Firmware/Tonokip_Firmware.pde +++ b/Tonokip_Firmware/Tonokip_Firmware.pde @@ -98,7 +98,7 @@ int16_t n; void initsd(){ sdactive=false; -if (!card.init(SPI_HALF_SPEED)){ +if (!card.init(SPI_FULL_SPEED)){ if (!card.init(SPI_HALF_SPEED)) Serial.println("SD init fail"); } @@ -115,6 +115,10 @@ else void setup() { + Serial.begin(BAUDRATE); + Serial.println("start"); + + //cmdbuffer[0]="\0"; //cmdbuffer[1]="\0"; //cmdbuffer[2]=char[4]; @@ -157,13 +161,11 @@ void setup() if(HEATER_0_PIN > -1) pinMode(HEATER_0_PIN,OUTPUT); - Serial.begin(BAUDRATE); #ifdef SDSUPPORT initsd(); #endif - Serial.println("start"); } @@ -272,6 +274,9 @@ inline void get_command() } } + else if(strstr(cmdbuffer[bufindw], "M105") != NULL){ + Serial.println("ok"); + } @@ -511,9 +516,6 @@ inline void process_commands() Serial.println( analog2temp(analogRead(TEMP_0_PIN)) ); Serial.print("Bed:"); Serial.println( analog2tempBed(analogRead(TEMP_1_PIN)) ); - if(!code_seen('N')) { - return; // If M105 is sent from generated gcode, then it needs a response. - } break; case 109: // M109 - Wait for heater to reach target. if (code_seen('S')) target_raw = temp2analog(code_value()); -- cgit v1.2.1