diff --git a/makefiles/virtual/mcu_virtual.cpp b/makefiles/virtual/mcu_virtual.cpp index f3ca93cad..44f086235 100644 --- a/makefiles/virtual/mcu_virtual.cpp +++ b/makefiles/virtual/mcu_virtual.cpp @@ -910,6 +910,13 @@ extern "C" } return 0; } + + uint8_t itp_set_step_mode(uint8_t mode) {return 0;} + + uint32_t mcu_free_micros(void) + { + return (uint32_t)(mcu_free_micros() % 1000); + } #ifdef __cplusplus } #endif diff --git a/uCNC/src/core/parser.c b/uCNC/src/core/parser.c index 39ff4b877..a0f05fe73 100644 --- a/uCNC/src/core/parser.c +++ b/uCNC/src/core/parser.c @@ -698,19 +698,19 @@ static uint8_t parser_fetch_command(parser_state_t *new_state, parser_words_t *w { case 50: mantissa++; - __attribute__((fallthrough)); + __FALL_THROUGH__ case 40: mantissa++; - __attribute__((fallthrough)); + __FALL_THROUGH__ case 30: mantissa++; - __attribute__((fallthrough)); + __FALL_THROUGH__ case 20: mantissa++; - __attribute__((fallthrough)); + __FALL_THROUGH__ case 10: mantissa++; - __attribute__((fallthrough)); + __FALL_THROUGH__ case 0: break; default: @@ -1471,7 +1471,7 @@ uint8_t parser_exec_command(parser_state_t *new_state, parser_words_t *words, pa break; case G92_1: // G92.1 memset(g92permanentoffset, 0, sizeof(g92permanentoffset)); - __attribute__((fallthrough)); + __FALL_THROUGH__ // continue case G92_2: // G92.2 memset(parser_parameters.g92_offset, 0, sizeof(parser_parameters.g92_offset)); @@ -1643,7 +1643,7 @@ uint8_t parser_exec_command(parser_state_t *new_state, parser_words_t *words, pa { block_data.spindle = 0; } - __attribute__((fallthrough)); + __FALL_THROUGH__ case G1: if (block_data.feed == 0) { @@ -2136,7 +2136,7 @@ static uint8_t parser_gcode_word(uint8_t code, uint8_t mantissa, parser_state_t { return STATUS_GCODE_UNSUPPORTED_COMMAND; } - __attribute__((fallthrough)); + __FALL_THROUGH__ #ifdef ENABLE_G39_H_MAPPING case 39: #endif @@ -2220,7 +2220,7 @@ static uint8_t parser_gcode_word(uint8_t code, uint8_t mantissa, parser_state_t { return STATUS_GCODE_UNSUPPORTED_COMMAND; } - __attribute__((fallthrough)); + __FALL_THROUGH__ case 49: new_state->groups.tlo_mode = ((code == 49) ? G49 : G43); new_group |= GCODE_GROUP_TOOLLENGTH; @@ -2270,7 +2270,7 @@ static uint8_t parser_gcode_word(uint8_t code, uint8_t mantissa, parser_state_t { return STATUS_GCODE_UNSUPPORTED_COMMAND; } - __attribute__((fallthrough)); + __FALL_THROUGH__ #ifndef DISABLE_G10_SUPPORT case 10: #endif @@ -2283,7 +2283,7 @@ static uint8_t parser_gcode_word(uint8_t code, uint8_t mantissa, parser_state_t return STATUS_GCODE_MODAL_GROUP_VIOLATION; } cmd->group_0_1_useaxis = 1; - __attribute__((fallthrough)); + __FALL_THROUGH__ case 4: case 53: // convert code within 4 bits without @@ -2327,10 +2327,10 @@ static uint8_t parser_mcode_word(uint8_t code, uint8_t mantissa, parser_state_t { case 60: code = 5; - __attribute__((fallthrough)); + __FALL_THROUGH__ case 30: code = (code & 1) ? 5 : 3; - __attribute__((fallthrough)); + __FALL_THROUGH__ case 0: case 1: case 2: diff --git a/uCNC/src/hal/mcus/avr/mcu_avr.c b/uCNC/src/hal/mcus/avr/mcu_avr.c index cf795031f..75c642140 100644 --- a/uCNC/src/hal/mcus/avr/mcu_avr.c +++ b/uCNC/src/hal/mcus/avr/mcu_avr.c @@ -1273,7 +1273,7 @@ ISR(TWI_vect, ISR_BLOCK) case TW_SR_ARB_LOST_SLA_ACK: case TW_SR_ARB_LOST_GCALL_ACK: index++; - __attribute__((fallthrough)); + __FALL_THROUGH__ case TW_SR_STOP: // stop or repeated start condition received // sends the data if (i < I2C_SLAVE_BUFFER_SIZE) @@ -1294,7 +1294,7 @@ ISR(TWI_vect, ISR_BLOCK) case TW_ST_SLA_ACK: case TW_ST_ARB_LOST_SLA_ACK: i = 0; - __attribute__((fallthrough)); + __FALL_THROUGH__ case TW_ST_DATA_ACK: // byte sent, ack returned // copy data to output register TWDR = mcu_i2c_buffer[i++]; diff --git a/uCNC/src/hal/mcus/lpc176x/mcu_lpc176x.c b/uCNC/src/hal/mcus/lpc176x/mcu_lpc176x.c index 4831af9c0..62c63cd65 100644 --- a/uCNC/src/hal/mcus/lpc176x/mcu_lpc176x.c +++ b/uCNC/src/hal/mcus/lpc176x/mcu_lpc176x.c @@ -1237,7 +1237,7 @@ void I2C_ISR(void) case 0x68: case 0x78: index++; - __attribute__((fallthrough)); + __FALL_THROUGH__ case 0xA0: // stop or repeated start condition received // sends the data if (i < I2C_SLAVE_BUFFER_SIZE) @@ -1258,7 +1258,7 @@ void I2C_ISR(void) case 0xA8: // addressed, returned ack case 0xB0: // arbitration lost, returned ack i = 0; - __attribute__((fallthrough)); + __FALL_THROUGH__ case 0xB8: // byte sent, ack returned // copy data to output register I2C_REG->I2DAT = mcu_i2c_buffer[i++]; diff --git a/uCNC/src/utils.h b/uCNC/src/utils.h index e883fae21..514bdb32e 100644 --- a/uCNC/src/utils.h +++ b/uCNC/src/utils.h @@ -436,6 +436,12 @@ extern "C" #define __TIMEOUT_MS__(timeout) timeout*=1000; __TIMEOUT_US__(timeout) #define __TIMEOUT_ASSERT__(timeout) if(timeout < 0) +#if defined(__GNUC__) && __GNUC__ >= 7 + #define __FALL_THROUGH__ __attribute__ ((fallthrough)); +#else + #define __FALL_THROUGH__ +#endif /* __GNUC__ >= 7 */ + #ifdef __cplusplus } #endif