diff options
author | kliment <kliment.yanev@gmail.com> | 2011-03-28 18:19:03 +0200 |
---|---|---|
committer | kliment <kliment.yanev@gmail.com> | 2011-03-28 18:19:03 +0200 |
commit | 00fbfefd12cc7e8792a091fd18baa2fdd1c13507 (patch) | |
tree | dc15be29c5f7e6ad5895fd27366488c313d389ad | |
parent | a3bd2c88b715e4b8c221c4e0debc7fdaa60b2f15 (diff) |
Changed initialization order to enable Mega 2560 users to connect more reliably
-rw-r--r-- | Tonokip_Firmware/Tonokip_Firmware.pde | 14 |
1 files changed, 8 insertions, 6 deletions
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()); |