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

This commit is contained in:
Bernhard Kubicek 2011-11-06 23:21:12 +01:00
parent 0b43761c3a
commit 907daa49af
4 changed files with 23 additions and 23 deletions

View File

@ -192,14 +192,14 @@ void setup()
Serial.begin(BAUDRATE); Serial.begin(BAUDRATE);
SERIAL_ECHOLN("Marlin "<<version_string); SERIAL_ECHOLN("Marlin "<<version_string);
Serial.println("start"); Serial.println("start");
for(int i = 0; i < BUFSIZE; i++) for(int8_t i = 0; i < BUFSIZE; i++)
{ {
fromsd[i] = false; fromsd[i] = false;
} }
RetrieveSettings(); // loads data from EEPROM if available RetrieveSettings(); // loads data from EEPROM if available
for(int i=0; i < NUM_AXIS; i++) for(int8_t i=0; i < NUM_AXIS; i++)
{ {
axis_steps_per_sqr_second[i] = max_acceleration_units_per_sq_second[i] * axis_steps_per_unit[i]; axis_steps_per_sqr_second[i] = max_acceleration_units_per_sq_second[i] * axis_steps_per_unit[i];
} }
@ -470,7 +470,7 @@ inline void process_commands()
saved_feedmultiply = feedmultiply; saved_feedmultiply = feedmultiply;
feedmultiply = 100; feedmultiply = 100;
for(int i=0; i < NUM_AXIS; i++) { for(int8_t i=0; i < NUM_AXIS; i++) {
destination[i] = current_position[i]; destination[i] = current_position[i];
} }
feedrate = 0.0; feedrate = 0.0;
@ -501,7 +501,7 @@ inline void process_commands()
case 92: // G92 case 92: // G92
if(!code_seen(axis_codes[E_AXIS])) if(!code_seen(axis_codes[E_AXIS]))
st_synchronize(); st_synchronize();
for(int i=0; i < NUM_AXIS; i++) { for(int8_t i=0; i < NUM_AXIS; i++) {
if(code_seen(axis_codes[i])) current_position[i] = code_value(); if(code_seen(axis_codes[i])) current_position[i] = code_value();
} }
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); 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()
if (code_seen('P') && pin_status >= 0 && pin_status <= 255) if (code_seen('P') && pin_status >= 0 && pin_status <= 255)
{ {
int pin_number = code_value(); int pin_number = code_value();
for(int i = 0; i < (int)sizeof(sensitive_pins); i++) for(int8_t i = 0; i < (int8_t)sizeof(sensitive_pins); i++)
{ {
if (sensitive_pins[i] == pin_number) if (sensitive_pins[i] == pin_number)
{ {
@ -759,7 +759,7 @@ inline void process_commands()
max_inactive_time = code_value() * 1000; max_inactive_time = code_value() * 1000;
break; break;
case 92: // M92 case 92: // M92
for(int i=0; i < NUM_AXIS; i++) for(int8_t i=0; i < NUM_AXIS; i++)
{ {
if(code_seen(axis_codes[i])) if(code_seen(axis_codes[i]))
axis_steps_per_unit[i] = code_value(); axis_steps_per_unit[i] = code_value();
@ -816,20 +816,20 @@ inline void process_commands()
break; break;
//TODO: update for all axis, use for loop //TODO: update for all axis, use for loop
case 201: // M201 case 201: // M201
for(int i=0; i < NUM_AXIS; i++) for(int8_t i=0; i < NUM_AXIS; i++)
{ {
if(code_seen(axis_codes[i])) axis_steps_per_sqr_second[i] = code_value() * axis_steps_per_unit[i]; if(code_seen(axis_codes[i])) axis_steps_per_sqr_second[i] = code_value() * axis_steps_per_unit[i];
} }
break; break;
#if 0 // Not used for Sprinter/grbl gen6 #if 0 // Not used for Sprinter/grbl gen6
case 202: // M202 case 202: // M202
for(int i=0; i < NUM_AXIS; i++) { for(int8_t i=0; i < NUM_AXIS; i++) {
if(code_seen(axis_codes[i])) axis_travel_steps_per_sqr_second[i] = code_value() * axis_steps_per_unit[i]; if(code_seen(axis_codes[i])) axis_travel_steps_per_sqr_second[i] = code_value() * axis_steps_per_unit[i];
} }
break; break;
#endif #endif
case 203: // M203 max feedrate mm/sec case 203: // M203 max feedrate mm/sec
for(int i=0; i < NUM_AXIS; i++) { for(int8_t i=0; i < NUM_AXIS; i++) {
if(code_seen(axis_codes[i])) max_feedrate[i] = code_value()*60 ; if(code_seen(axis_codes[i])) max_feedrate[i] = code_value()*60 ;
} }
break; break;
@ -914,7 +914,7 @@ void ClearToSend()
inline void get_coordinates() inline void get_coordinates()
{ {
for(int i=0; i < NUM_AXIS; i++) { for(int8_t i=0; i < NUM_AXIS; i++) {
if(code_seen(axis_codes[i])) destination[i] = (float)code_value() + (axis_relative_modes[i] || relative_mode)*current_position[i]; if(code_seen(axis_codes[i])) destination[i] = (float)code_value() + (axis_relative_modes[i] || relative_mode)*current_position[i];
else destination[i] = current_position[i]; //Are these else lines really needed? else destination[i] = current_position[i]; //Are these else lines really needed?
} }
@ -934,7 +934,7 @@ inline void get_arc_coordinates()
void prepare_move() void prepare_move()
{ {
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60.0/100.0); plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60.0/100.0);
for(int i=0; i < NUM_AXIS; i++) { for(int8_t i=0; i < NUM_AXIS; i++) {
current_position[i] = destination[i]; current_position[i] = destination[i];
} }
} }
@ -948,7 +948,7 @@ void prepare_arc_move(char isclockwise) {
// As far as the parser is concerned, the position is now == target. In reality the // As far as the parser is concerned, the position is now == target. In reality the
// motion control system might still be processing the action and the real tool position // motion control system might still be processing the action and the real tool position
// in any intermediate location. // in any intermediate location.
for(int i=0; i < NUM_AXIS; i++) { for(int8_t i=0; i < NUM_AXIS; i++) {
current_position[i] = destination[i]; current_position[i] = destination[i];
} }
} }

View File

@ -167,7 +167,7 @@ void CardReader::checkautostart(bool force)
static int lastnr=0; static int lastnr=0;
char autoname[30]; char autoname[30];
sprintf(autoname,"auto%i.g",lastnr); sprintf(autoname,"auto%i.g",lastnr);
for(int i=0;i<(int)strlen(autoname);i++) for(int8_t i=0;i<(int)strlen(autoname);i++)
autoname[i]=tolower(autoname[i]); autoname[i]=tolower(autoname[i]);
dir_t p; dir_t p;
@ -176,7 +176,7 @@ void CardReader::checkautostart(bool force)
bool found=false; bool found=false;
while (root.readDir(p) > 0) while (root.readDir(p) > 0)
{ {
for(int i=0;i<(int)strlen((char*)p.name);i++) for(int8_t i=0;i<(int)strlen((char*)p.name);i++)
p.name[i]=tolower(p.name[i]); p.name[i]=tolower(p.name[i]);
//Serial.print((char*)p.name); //Serial.print((char*)p.name);
//Serial.print(" "); //Serial.print(" ");
@ -222,7 +222,7 @@ void CardReader::getfilename(const uint8_t nr)
if(cnt++!=nr) continue; if(cnt++!=nr) continue;
//Serial.println((char*)p.name); //Serial.println((char*)p.name);
uint8_t writepos=0; uint8_t writepos=0;
for (uint8_t i = 0; i < 11; i++) for (int8_t i = 0; i < 11; i++)
{ {
if (p.name[i] == ' ') continue; if (p.name[i] == ' ') continue;
if (i == 8) { if (i == 8) {

View File

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

View File

@ -80,7 +80,7 @@ void beep()
//return; //return;
#ifdef ULTIPANEL #ifdef ULTIPANEL
pinMode(BEEPER,OUTPUT); pinMode(BEEPER,OUTPUT);
for(int i=0;i<20;i++){ for(int8_t i=0;i<20;i++){
WRITE(BEEPER,HIGH); WRITE(BEEPER,HIGH);
delay(5); delay(5);
WRITE(BEEPER,LOW); WRITE(BEEPER,LOW);
@ -94,7 +94,7 @@ void beepshort()
//return; //return;
#ifdef ULTIPANEL #ifdef ULTIPANEL
pinMode(BEEPER,OUTPUT); pinMode(BEEPER,OUTPUT);
for(int i=0;i<10;i++){ for(int8_t i=0;i<10;i++){
WRITE(BEEPER,HIGH); WRITE(BEEPER,HIGH);
delay(3); delay(3);
WRITE(BEEPER,LOW); WRITE(BEEPER,LOW);
@ -165,7 +165,7 @@ void buttons_check()
WRITE(SHIFT_LD,LOW); WRITE(SHIFT_LD,LOW);
WRITE(SHIFT_LD,HIGH); WRITE(SHIFT_LD,HIGH);
unsigned char tmp_buttons=0; unsigned char tmp_buttons=0;
for(unsigned char i=0;i<8;i++) for(int8_t i=0;i<8;i++)
{ {
newbutton = newbutton>>1; newbutton = newbutton>>1;
if(READ(SHIFT_OUT)) if(READ(SHIFT_OUT))
@ -375,7 +375,7 @@ void MainMenu::showPrepare()
force_lcd_update=true; force_lcd_update=true;
clear(); clear();
} }
for(uint8_t i=lineoffset;i<lineoffset+LCD_HEIGHT;i++) for(int8_t i=lineoffset;i<lineoffset+LCD_HEIGHT;i++)
{ {
//Serial.println((int)(line-lineoffset)); //Serial.println((int)(line-lineoffset));
switch(i) switch(i)
@ -512,7 +512,7 @@ void MainMenu::showControl()
force_lcd_update=true; force_lcd_update=true;
clear(); clear();
} }
for(uint8_t i=lineoffset;i<lineoffset+LCD_HEIGHT;i++) for(int8_t i=lineoffset;i<lineoffset+LCD_HEIGHT;i++)
{ {
switch(i) switch(i)
{ {
@ -1196,7 +1196,7 @@ void MainMenu::showSD()
BLOCK BLOCK
card.getfilename(i-2); card.getfilename(i-2);
char cmd[30]; char cmd[30];
for(int i=0;i<strlen(card.filename);i++) for(int8_t i=0;i<strlen(card.filename);i++)
card.filename[i]=tolower(card.filename[i]); card.filename[i]=tolower(card.filename[i]);
sprintf(cmd,"M23 %s",card.filename); sprintf(cmd,"M23 %s",card.filename);
//sprintf(cmd,"M115"); //sprintf(cmd,"M115");
@ -1265,7 +1265,7 @@ void MainMenu::showMainMenu()
//Serial.println((int)activeline); //Serial.println((int)activeline);
if(force_lcd_update) if(force_lcd_update)
clear(); clear();
for(short line=0;line<LCD_HEIGHT;line++) for(int8_t line=0;line<LCD_HEIGHT;line++)
{ {
switch(line) switch(line)
{ {