Browse Source

made loop counters uint8_t most were int(16_t) before

Bernhard Kubicek 13 years ago
parent
commit
907daa49af
4 changed files with 23 additions and 23 deletions
  1. 12
    12
      Marlin/Marlin.pde
  2. 3
    3
      Marlin/cardreader.pde
  3. 1
    1
      Marlin/stepper.cpp
  4. 7
    7
      Marlin/ultralcd.pde

+ 12
- 12
Marlin/Marlin.pde View File

192
   Serial.begin(BAUDRATE);
192
   Serial.begin(BAUDRATE);
193
   SERIAL_ECHOLN("Marlin "<<version_string);
193
   SERIAL_ECHOLN("Marlin "<<version_string);
194
   Serial.println("start");
194
   Serial.println("start");
195
-  for(int i = 0; i < BUFSIZE; i++)
195
+  for(int8_t i = 0; i < BUFSIZE; i++)
196
   {
196
   {
197
     fromsd[i] = false;
197
     fromsd[i] = false;
198
   }
198
   }
199
   
199
   
200
   RetrieveSettings(); // loads data from EEPROM if available
200
   RetrieveSettings(); // loads data from EEPROM if available
201
 
201
 
202
-  for(int i=0; i < NUM_AXIS; i++)
202
+  for(int8_t i=0; i < NUM_AXIS; i++)
203
   {
203
   {
204
     axis_steps_per_sqr_second[i] = max_acceleration_units_per_sq_second[i] * axis_steps_per_unit[i];
204
     axis_steps_per_sqr_second[i] = max_acceleration_units_per_sq_second[i] * axis_steps_per_unit[i];
205
   }
205
   }
470
       saved_feedmultiply = feedmultiply;
470
       saved_feedmultiply = feedmultiply;
471
       feedmultiply = 100;
471
       feedmultiply = 100;
472
       
472
       
473
-      for(int i=0; i < NUM_AXIS; i++) {
473
+      for(int8_t i=0; i < NUM_AXIS; i++) {
474
         destination[i] = current_position[i];
474
         destination[i] = current_position[i];
475
       }
475
       }
476
       feedrate = 0.0;
476
       feedrate = 0.0;
501
     case 92: // G92
501
     case 92: // G92
502
       if(!code_seen(axis_codes[E_AXIS])) 
502
       if(!code_seen(axis_codes[E_AXIS])) 
503
         st_synchronize();
503
         st_synchronize();
504
-      for(int i=0; i < NUM_AXIS; i++) {
504
+      for(int8_t i=0; i < NUM_AXIS; i++) {
505
         if(code_seen(axis_codes[i])) current_position[i] = code_value();  
505
         if(code_seen(axis_codes[i])) current_position[i] = code_value();  
506
       }
506
       }
507
       plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
507
       plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
587
         if (code_seen('P') && pin_status >= 0 && pin_status <= 255)
587
         if (code_seen('P') && pin_status >= 0 && pin_status <= 255)
588
         {
588
         {
589
           int pin_number = code_value();
589
           int pin_number = code_value();
590
-          for(int i = 0; i < (int)sizeof(sensitive_pins); i++)
590
+          for(int8_t i = 0; i < (int8_t)sizeof(sensitive_pins); i++)
591
           {
591
           {
592
             if (sensitive_pins[i] == pin_number)
592
             if (sensitive_pins[i] == pin_number)
593
             {
593
             {
759
       max_inactive_time = code_value() * 1000; 
759
       max_inactive_time = code_value() * 1000; 
760
       break;
760
       break;
761
     case 92: // M92
761
     case 92: // M92
762
-      for(int i=0; i < NUM_AXIS; i++) 
762
+      for(int8_t i=0; i < NUM_AXIS; i++) 
763
       {
763
       {
764
         if(code_seen(axis_codes[i])) 
764
         if(code_seen(axis_codes[i])) 
765
           axis_steps_per_unit[i] = code_value();
765
           axis_steps_per_unit[i] = code_value();
816
       break;
816
       break;
817
       //TODO: update for all axis, use for loop
817
       //TODO: update for all axis, use for loop
818
     case 201: // M201
818
     case 201: // M201
819
-      for(int i=0; i < NUM_AXIS; i++) 
819
+      for(int8_t i=0; i < NUM_AXIS; i++) 
820
       {
820
       {
821
         if(code_seen(axis_codes[i])) axis_steps_per_sqr_second[i] = code_value() * axis_steps_per_unit[i];
821
         if(code_seen(axis_codes[i])) axis_steps_per_sqr_second[i] = code_value() * axis_steps_per_unit[i];
822
       }
822
       }
823
       break;
823
       break;
824
     #if 0 // Not used for Sprinter/grbl gen6
824
     #if 0 // Not used for Sprinter/grbl gen6
825
     case 202: // M202
825
     case 202: // M202
826
-      for(int i=0; i < NUM_AXIS; i++) {
826
+      for(int8_t i=0; i < NUM_AXIS; i++) {
827
         if(code_seen(axis_codes[i])) axis_travel_steps_per_sqr_second[i] = code_value() * axis_steps_per_unit[i];
827
         if(code_seen(axis_codes[i])) axis_travel_steps_per_sqr_second[i] = code_value() * axis_steps_per_unit[i];
828
       }
828
       }
829
       break;
829
       break;
830
     #endif
830
     #endif
831
     case 203: // M203 max feedrate mm/sec
831
     case 203: // M203 max feedrate mm/sec
832
-      for(int i=0; i < NUM_AXIS; i++) {
832
+      for(int8_t i=0; i < NUM_AXIS; i++) {
833
         if(code_seen(axis_codes[i])) max_feedrate[i] = code_value()*60 ;
833
         if(code_seen(axis_codes[i])) max_feedrate[i] = code_value()*60 ;
834
       }
834
       }
835
       break;
835
       break;
914
 
914
 
915
 inline void get_coordinates()
915
 inline void get_coordinates()
916
 {
916
 {
917
-  for(int i=0; i < NUM_AXIS; i++) {
917
+  for(int8_t i=0; i < NUM_AXIS; i++) {
918
     if(code_seen(axis_codes[i])) destination[i] = (float)code_value() + (axis_relative_modes[i] || relative_mode)*current_position[i];
918
     if(code_seen(axis_codes[i])) destination[i] = (float)code_value() + (axis_relative_modes[i] || relative_mode)*current_position[i];
919
     else destination[i] = current_position[i]; //Are these else lines really needed?
919
     else destination[i] = current_position[i]; //Are these else lines really needed?
920
   }
920
   }
934
 void prepare_move()
934
 void prepare_move()
935
 {
935
 {
936
   plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60.0/100.0);
936
   plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60.0/100.0);
937
-  for(int i=0; i < NUM_AXIS; i++) {
937
+  for(int8_t i=0; i < NUM_AXIS; i++) {
938
     current_position[i] = destination[i];
938
     current_position[i] = destination[i];
939
   }
939
   }
940
 }
940
 }
948
   // As far as the parser is concerned, the position is now == target. In reality the
948
   // As far as the parser is concerned, the position is now == target. In reality the
949
   // motion control system might still be processing the action and the real tool position
949
   // motion control system might still be processing the action and the real tool position
950
   // in any intermediate location.
950
   // in any intermediate location.
951
-  for(int i=0; i < NUM_AXIS; i++) {
951
+  for(int8_t i=0; i < NUM_AXIS; i++) {
952
     current_position[i] = destination[i];
952
     current_position[i] = destination[i];
953
   }
953
   }
954
 }
954
 }

+ 3
- 3
Marlin/cardreader.pde View File

167
   static int lastnr=0;
167
   static int lastnr=0;
168
   char autoname[30];
168
   char autoname[30];
169
   sprintf(autoname,"auto%i.g",lastnr);
169
   sprintf(autoname,"auto%i.g",lastnr);
170
-  for(int i=0;i<(int)strlen(autoname);i++)
170
+  for(int8_t i=0;i<(int)strlen(autoname);i++)
171
     autoname[i]=tolower(autoname[i]);
171
     autoname[i]=tolower(autoname[i]);
172
   dir_t p;
172
   dir_t p;
173
 
173
 
176
   bool found=false;
176
   bool found=false;
177
   while (root.readDir(p) > 0) 
177
   while (root.readDir(p) > 0) 
178
   {
178
   {
179
-    for(int i=0;i<(int)strlen((char*)p.name);i++)
179
+    for(int8_t i=0;i<(int)strlen((char*)p.name);i++)
180
     p.name[i]=tolower(p.name[i]);
180
     p.name[i]=tolower(p.name[i]);
181
     //Serial.print((char*)p.name);
181
     //Serial.print((char*)p.name);
182
     //Serial.print(" ");
182
     //Serial.print(" ");
222
     if(cnt++!=nr) continue;
222
     if(cnt++!=nr) continue;
223
     //Serial.println((char*)p.name);
223
     //Serial.println((char*)p.name);
224
     uint8_t writepos=0;
224
     uint8_t writepos=0;
225
-    for (uint8_t i = 0; i < 11; i++) 
225
+    for (int8_t i = 0; i < 11; i++) 
226
     {
226
     {
227
       if (p.name[i] == ' ') continue;
227
       if (p.name[i] == ' ') continue;
228
       if (i == 8) {
228
       if (i == 8) {

+ 1
- 1
Marlin/stepper.cpp View File

345
         WRITE(E_DIR_PIN,!INVERT_E_DIR);
345
         WRITE(E_DIR_PIN,!INVERT_E_DIR);
346
     #endif //!ADVANCE
346
     #endif //!ADVANCE
347
 
347
 
348
-    for(char i=0; i < step_loops; i++) { // Take multiple steps per interrupt (For high speed moves) 
348
+    for(int8_t i=0; i < step_loops; i++) { // Take multiple steps per interrupt (For high speed moves) 
349
       counter_x += current_block->steps_x;
349
       counter_x += current_block->steps_x;
350
       if (counter_x > 0) {
350
       if (counter_x > 0) {
351
         WRITE(X_STEP_PIN, HIGH);
351
         WRITE(X_STEP_PIN, HIGH);

+ 7
- 7
Marlin/ultralcd.pde View File

80
   //return;
80
   //return;
81
   #ifdef ULTIPANEL
81
   #ifdef ULTIPANEL
82
     pinMode(BEEPER,OUTPUT);
82
     pinMode(BEEPER,OUTPUT);
83
-    for(int i=0;i<20;i++){
83
+    for(int8_t i=0;i<20;i++){
84
       WRITE(BEEPER,HIGH);
84
       WRITE(BEEPER,HIGH);
85
       delay(5);
85
       delay(5);
86
       WRITE(BEEPER,LOW);
86
       WRITE(BEEPER,LOW);
94
   //return;
94
   //return;
95
   #ifdef ULTIPANEL
95
   #ifdef ULTIPANEL
96
     pinMode(BEEPER,OUTPUT);
96
     pinMode(BEEPER,OUTPUT);
97
-    for(int i=0;i<10;i++){
97
+    for(int8_t i=0;i<10;i++){
98
       WRITE(BEEPER,HIGH);
98
       WRITE(BEEPER,HIGH);
99
       delay(3);
99
       delay(3);
100
       WRITE(BEEPER,LOW);
100
       WRITE(BEEPER,LOW);
165
     WRITE(SHIFT_LD,LOW);
165
     WRITE(SHIFT_LD,LOW);
166
     WRITE(SHIFT_LD,HIGH);
166
     WRITE(SHIFT_LD,HIGH);
167
     unsigned char tmp_buttons=0;
167
     unsigned char tmp_buttons=0;
168
-    for(unsigned char i=0;i<8;i++)
168
+    for(int8_t i=0;i<8;i++)
169
     { 
169
     { 
170
       newbutton = newbutton>>1;
170
       newbutton = newbutton>>1;
171
       if(READ(SHIFT_OUT))
171
       if(READ(SHIFT_OUT))
375
    force_lcd_update=true;
375
    force_lcd_update=true;
376
    clear(); 
376
    clear(); 
377
  }
377
  }
378
- for(uint8_t i=lineoffset;i<lineoffset+LCD_HEIGHT;i++)
378
+ for(int8_t i=lineoffset;i<lineoffset+LCD_HEIGHT;i++)
379
  {
379
  {
380
    //Serial.println((int)(line-lineoffset));
380
    //Serial.println((int)(line-lineoffset));
381
   switch(i)
381
   switch(i)
512
    force_lcd_update=true;
512
    force_lcd_update=true;
513
    clear();
513
    clear();
514
  }
514
  }
515
- for(uint8_t i=lineoffset;i<lineoffset+LCD_HEIGHT;i++)
515
+ for(int8_t i=lineoffset;i<lineoffset+LCD_HEIGHT;i++)
516
  {
516
  {
517
   switch(i)
517
   switch(i)
518
   {
518
   {
1196
           BLOCK
1196
           BLOCK
1197
           card.getfilename(i-2);
1197
           card.getfilename(i-2);
1198
           char cmd[30];
1198
           char cmd[30];
1199
-          for(int i=0;i<strlen(card.filename);i++)
1199
+          for(int8_t i=0;i<strlen(card.filename);i++)
1200
             card.filename[i]=tolower(card.filename[i]);
1200
             card.filename[i]=tolower(card.filename[i]);
1201
           sprintf(cmd,"M23 %s",card.filename);
1201
           sprintf(cmd,"M23 %s",card.filename);
1202
           //sprintf(cmd,"M115");
1202
           //sprintf(cmd,"M115");
1265
    //Serial.println((int)activeline);
1265
    //Serial.println((int)activeline);
1266
    if(force_lcd_update)
1266
    if(force_lcd_update)
1267
      clear();
1267
      clear();
1268
-  for(short line=0;line<LCD_HEIGHT;line++)
1268
+  for(int8_t line=0;line<LCD_HEIGHT;line++)
1269
   {
1269
   {
1270
     switch(line)
1270
     switch(line)
1271
     { 
1271
     { 

Loading…
Cancel
Save