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_ECHOLN("Marlin "<<version_string);
Serial.println("start");
for(int i = 0; i < BUFSIZE; i++)
for(int8_t i = 0; i < BUFSIZE; i++)
{
fromsd[i] = false;
}
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];
}
@ -470,7 +470,7 @@ inline void process_commands()
saved_feedmultiply = feedmultiply;
feedmultiply = 100;
for(int i=0; i < NUM_AXIS; i++) {
for(int8_t i=0; i < NUM_AXIS; i++) {
destination[i] = current_position[i];
}
feedrate = 0.0;
@ -501,7 +501,7 @@ inline void process_commands()
case 92: // G92
if(!code_seen(axis_codes[E_AXIS]))
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();
}
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)
{
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)
{
@ -759,7 +759,7 @@ inline void process_commands()
max_inactive_time = code_value() * 1000;
break;
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]))
axis_steps_per_unit[i] = code_value();
@ -816,20 +816,20 @@ inline void process_commands()
break;
//TODO: update for all axis, use for loop
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];
}
break;
#if 0 // Not used for Sprinter/grbl gen6
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];
}
break;
#endif
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 ;
}
break;
@ -914,7 +914,7 @@ void ClearToSend()
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];
else destination[i] = current_position[i]; //Are these else lines really needed?
}
@ -934,7 +934,7 @@ inline void get_arc_coordinates()
void prepare_move()
{
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];
}
}
@ -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
// motion control system might still be processing the action and the real tool position
// 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];
}
}

View File

@ -167,7 +167,7 @@ void CardReader::checkautostart(bool force)
static int lastnr=0;
char autoname[30];
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]);
dir_t p;
@ -176,7 +176,7 @@ void CardReader::checkautostart(bool force)
bool found=false;
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]);
//Serial.print((char*)p.name);
//Serial.print(" ");
@ -222,7 +222,7 @@ void CardReader::getfilename(const uint8_t nr)
if(cnt++!=nr) continue;
//Serial.println((char*)p.name);
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 (i == 8) {

View File

@ -345,7 +345,7 @@ ISR(TIMER1_COMPA_vect)
WRITE(E_DIR_PIN,!INVERT_E_DIR);
#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;
if (counter_x > 0) {
WRITE(X_STEP_PIN, HIGH);

View File

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