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,14 +192,14 @@ void setup()
192 192
   Serial.begin(BAUDRATE);
193 193
   SERIAL_ECHOLN("Marlin "<<version_string);
194 194
   Serial.println("start");
195
-  for(int i = 0; i < BUFSIZE; i++)
195
+  for(int8_t i = 0; i < BUFSIZE; i++)
196 196
   {
197 197
     fromsd[i] = false;
198 198
   }
199 199
   
200 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 204
     axis_steps_per_sqr_second[i] = max_acceleration_units_per_sq_second[i] * axis_steps_per_unit[i];
205 205
   }
@@ -470,7 +470,7 @@ inline void process_commands()
470 470
       saved_feedmultiply = feedmultiply;
471 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 474
         destination[i] = current_position[i];
475 475
       }
476 476
       feedrate = 0.0;
@@ -501,7 +501,7 @@ inline void process_commands()
501 501
     case 92: // G92
502 502
       if(!code_seen(axis_codes[E_AXIS])) 
503 503
         st_synchronize();
504
-      for(int i=0; i < NUM_AXIS; i++) {
504
+      for(int8_t i=0; i < NUM_AXIS; i++) {
505 505
         if(code_seen(axis_codes[i])) current_position[i] = code_value();  
506 506
       }
507 507
       plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
@@ -587,7 +587,7 @@ inline void process_commands()
587 587
         if (code_seen('P') && pin_status >= 0 && pin_status <= 255)
588 588
         {
589 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 592
             if (sensitive_pins[i] == pin_number)
593 593
             {
@@ -759,7 +759,7 @@ inline void process_commands()
759 759
       max_inactive_time = code_value() * 1000; 
760 760
       break;
761 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 764
         if(code_seen(axis_codes[i])) 
765 765
           axis_steps_per_unit[i] = code_value();
@@ -816,20 +816,20 @@ inline void process_commands()
816 816
       break;
817 817
       //TODO: update for all axis, use for loop
818 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 821
         if(code_seen(axis_codes[i])) axis_steps_per_sqr_second[i] = code_value() * axis_steps_per_unit[i];
822 822
       }
823 823
       break;
824 824
     #if 0 // Not used for Sprinter/grbl gen6
825 825
     case 202: // M202
826
-      for(int i=0; i < NUM_AXIS; i++) {
826
+      for(int8_t i=0; i < NUM_AXIS; i++) {
827 827
         if(code_seen(axis_codes[i])) axis_travel_steps_per_sqr_second[i] = code_value() * axis_steps_per_unit[i];
828 828
       }
829 829
       break;
830 830
     #endif
831 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 833
         if(code_seen(axis_codes[i])) max_feedrate[i] = code_value()*60 ;
834 834
       }
835 835
       break;
@@ -914,7 +914,7 @@ void ClearToSend()
914 914
 
915 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 918
     if(code_seen(axis_codes[i])) destination[i] = (float)code_value() + (axis_relative_modes[i] || relative_mode)*current_position[i];
919 919
     else destination[i] = current_position[i]; //Are these else lines really needed?
920 920
   }
@@ -934,7 +934,7 @@ inline void get_arc_coordinates()
934 934
 void prepare_move()
935 935
 {
936 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 938
     current_position[i] = destination[i];
939 939
   }
940 940
 }
@@ -948,7 +948,7 @@ void prepare_arc_move(char isclockwise) {
948 948
   // As far as the parser is concerned, the position is now == target. In reality the
949 949
   // motion control system might still be processing the action and the real tool position
950 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 952
     current_position[i] = destination[i];
953 953
   }
954 954
 }

+ 3
- 3
Marlin/cardreader.pde View File

@@ -167,7 +167,7 @@ void CardReader::checkautostart(bool force)
167 167
   static int lastnr=0;
168 168
   char autoname[30];
169 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 171
     autoname[i]=tolower(autoname[i]);
172 172
   dir_t p;
173 173
 
@@ -176,7 +176,7 @@ void CardReader::checkautostart(bool force)
176 176
   bool found=false;
177 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 180
     p.name[i]=tolower(p.name[i]);
181 181
     //Serial.print((char*)p.name);
182 182
     //Serial.print(" ");
@@ -222,7 +222,7 @@ void CardReader::getfilename(const uint8_t nr)
222 222
     if(cnt++!=nr) continue;
223 223
     //Serial.println((char*)p.name);
224 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 227
       if (p.name[i] == ' ') continue;
228 228
       if (i == 8) {

+ 1
- 1
Marlin/stepper.cpp View File

@@ -345,7 +345,7 @@ ISR(TIMER1_COMPA_vect)
345 345
         WRITE(E_DIR_PIN,!INVERT_E_DIR);
346 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 349
       counter_x += current_block->steps_x;
350 350
       if (counter_x > 0) {
351 351
         WRITE(X_STEP_PIN, HIGH);

+ 7
- 7
Marlin/ultralcd.pde View File

@@ -80,7 +80,7 @@ void beep()
80 80
   //return;
81 81
   #ifdef ULTIPANEL
82 82
     pinMode(BEEPER,OUTPUT);
83
-    for(int i=0;i<20;i++){
83
+    for(int8_t i=0;i<20;i++){
84 84
       WRITE(BEEPER,HIGH);
85 85
       delay(5);
86 86
       WRITE(BEEPER,LOW);
@@ -94,7 +94,7 @@ void beepshort()
94 94
   //return;
95 95
   #ifdef ULTIPANEL
96 96
     pinMode(BEEPER,OUTPUT);
97
-    for(int i=0;i<10;i++){
97
+    for(int8_t i=0;i<10;i++){
98 98
       WRITE(BEEPER,HIGH);
99 99
       delay(3);
100 100
       WRITE(BEEPER,LOW);
@@ -165,7 +165,7 @@ void buttons_check()
165 165
     WRITE(SHIFT_LD,LOW);
166 166
     WRITE(SHIFT_LD,HIGH);
167 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 170
       newbutton = newbutton>>1;
171 171
       if(READ(SHIFT_OUT))
@@ -375,7 +375,7 @@ void MainMenu::showPrepare()
375 375
    force_lcd_update=true;
376 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 380
    //Serial.println((int)(line-lineoffset));
381 381
   switch(i)
@@ -512,7 +512,7 @@ void MainMenu::showControl()
512 512
    force_lcd_update=true;
513 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 517
   switch(i)
518 518
   {
@@ -1196,7 +1196,7 @@ void MainMenu::showSD()
1196 1196
           BLOCK
1197 1197
           card.getfilename(i-2);
1198 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 1200
             card.filename[i]=tolower(card.filename[i]);
1201 1201
           sprintf(cmd,"M23 %s",card.filename);
1202 1202
           //sprintf(cmd,"M115");
@@ -1265,7 +1265,7 @@ void MainMenu::showMainMenu()
1265 1265
    //Serial.println((int)activeline);
1266 1266
    if(force_lcd_update)
1267 1267
      clear();
1268
-  for(short line=0;line<LCD_HEIGHT;line++)
1268
+  for(int8_t line=0;line<LCD_HEIGHT;line++)
1269 1269
   {
1270 1270
     switch(line)
1271 1271
     { 

Loading…
Cancel
Save