From 9274f0061d351a8c2ec759b6a3d47193dc016074 Mon Sep 17 00:00:00 2001 From: Joseph Coffland Date: Wed, 7 Mar 2018 23:23:59 -0800 Subject: [PATCH] Switch to C++ compiler --- src/avr/Makefile | 5 +++-- src/avr/src/command.c | 4 ++-- src/avr/src/commands.c | 4 ++-- src/avr/src/drv8711.c | 6 +++--- src/avr/src/estop.c | 2 +- src/avr/src/exec.c | 8 ++++---- src/avr/src/io.c | 4 ++-- src/avr/src/line.c | 9 +++++---- src/avr/src/motor.c | 13 +++++++------ src/avr/src/outputs.c | 12 ++++++------ src/avr/src/seek.c | 8 ++++---- src/avr/src/spindle.c | 2 +- src/avr/src/state.c | 9 ++++----- src/avr/src/status.c | 6 +++--- src/avr/src/switch.c | 22 ++++++++++++++++------ src/avr/src/switch.h | 5 +++-- src/avr/src/type.c | 20 ++++++++++---------- src/avr/src/type.def | 6 +----- src/avr/src/type.h | 1 + src/avr/src/usart.c | 10 +++++++--- src/avr/src/vars.c | 6 +++--- src/avr/src/vars.def | 22 +++++++++++----------- 22 files changed, 99 insertions(+), 85 deletions(-) diff --git a/src/avr/Makefile b/src/avr/Makefile index d232216..bf6bbe7 100644 --- a/src/avr/Makefile +++ b/src/avr/Makefile @@ -6,16 +6,17 @@ CLOCK = 32000000 TARGET = $(PROJECT).elf # Compile flags -CC = avr-gcc +CC = avr-g++ COMMON = -mmcu=$(MCU) -flto -fwhole-program CFLAGS += $(COMMON) CFLAGS += -Wall -Werror CFLAGS += -Wno-error=strict-aliasing # for _invsqrt -CFLAGS += -std=gnu99 -DF_CPU=$(CLOCK)UL -O3 +CFLAGS += -std=gnu++98 -DF_CPU=$(CLOCK)UL -O3 CFLAGS += -funsigned-bitfields -fpack-struct -fshort-enums -funsigned-char CFLAGS += -MD -MP -MT $@ -MF build/dep/$(@F).d +CFLAGS += -D__STDC_LIMIT_MACROS CFLAGS += -Isrc # Linker flags diff --git a/src/avr/src/command.c b/src/avr/src/command.c index d9e7780..ec8229d 100644 --- a/src/avr/src/command.c +++ b/src/avr/src/command.c @@ -80,7 +80,7 @@ static struct { // Define command callbacks #define CMD(CODE, NAME, SYNC, ...) \ - stat_t command_##NAME(); \ + stat_t command_##NAME(char *); \ IF(SYNC)(unsigned command_##NAME##_size();) \ IF(SYNC)(void command_##NAME##_exec(void *);) #include "command.def" @@ -155,7 +155,7 @@ unsigned command_get_count() {return cmd.count;} void command_print_json() { bool first = true; static const char fmt[] PROGMEM = - "\"%c\":{\"name\":\"%"PRPSTR"\",\"help\":\"%"PRPSTR"\"}"; + "\"%c\":{\"name\":\"%" PRPSTR "\",\"help\":\"%" PRPSTR "\"}"; #define CMD(CODE, NAME, SYNC, HELP) \ if (first) first = false; else putchar(','); \ diff --git a/src/avr/src/commands.c b/src/avr/src/commands.c index 59ad978..fea4a80 100644 --- a/src/avr/src/commands.c +++ b/src/avr/src/commands.c @@ -54,8 +54,8 @@ static stat_t _dwell_exec() { unsigned command_dwell_size() {return sizeof(float);} -void command_dwell_exec(float *seconds) { - st_prep_dwell(*seconds); +void command_dwell_exec(void *seconds) { + st_prep_dwell(*(float *)seconds); exec_set_cb(_dwell_exec); // Necessary evil } diff --git a/src/avr/src/drv8711.c b/src/avr/src/drv8711.c index 9deaf5b..37583d7 100644 --- a/src/avr/src/drv8711.c +++ b/src/avr/src/drv8711.c @@ -57,6 +57,9 @@ typedef struct { typedef struct { + uint8_t cs_pin; + switch_id_t stall_sw; + uint8_t status; uint16_t flags; bool stalled; @@ -68,9 +71,6 @@ typedef struct { uint8_t mode; // microstepping mode stall_callback_t stall_cb; - - uint8_t cs_pin; - switch_id_t stall_sw; } drv8711_driver_t; diff --git a/src/avr/src/estop.c b/src/avr/src/estop.c index c933560..be2aebc 100644 --- a/src/avr/src/estop.c +++ b/src/avr/src/estop.c @@ -56,7 +56,7 @@ static void _set_reason(stat_t reason) { static stat_t _get_reason() { - return eeprom_read_word(&estop_reason_eeprom); + return (stat_t)eeprom_read_word(&estop_reason_eeprom); } diff --git a/src/avr/src/exec.c b/src/avr/src/exec.c index 68614cf..2ffc957 100644 --- a/src/avr/src/exec.c +++ b/src/avr/src/exec.c @@ -66,8 +66,8 @@ void exec_init() { // TODO implement overrides // Set callback for limit switches - for (switch_id_t sw = SW_MIN_X; sw <= SW_MAX_A; sw++) - switch_set_callback(sw, _limit_switch_cb); + for (int sw = SW_MIN_X; sw <= SW_MAX_A; sw++) + switch_set_callback((switch_id_t)sw, _limit_switch_cb); } @@ -145,10 +145,10 @@ stat_t command_set_axis(char *cmd) { if (*cmd) return STAT_INVALID_ARGUMENTS; // Update command - command_set_axis_position(axis, position); + command_set_axis_position((uint8_t)axis, position); // Queue - set_axis_t set_axis = {axis, position}; + set_axis_t set_axis = {(uint8_t)axis, position}; command_push(COMMAND_set_axis, &set_axis); return STAT_OK; diff --git a/src/avr/src/io.c b/src/avr/src/io.c index db2325b..42b52ce 100644 --- a/src/avr/src/io.c +++ b/src/avr/src/io.c @@ -66,7 +66,7 @@ void io_rtc_callback() { } else result = analog_get(active_cmd.port); // TODO find a better way to send this - printf("{\"result\": %f}\n", result); + printf("{\"result\": %f}\n", (double)result); active_cmd.port = -1; } } @@ -96,7 +96,7 @@ stat_t command_input(char *cmd) { // Mode if (!isdigit(*cmd)) return STAT_INVALID_ARGUMENTS; - input_cmd.mode = *cmd - '0'; + input_cmd.mode = (input_mode_t)(*cmd - '0'); if (INPUT_LOW < input_cmd.mode) return STAT_INVALID_ARGUMENTS; cmd++; diff --git a/src/avr/src/line.c b/src/avr/src/line.c index de219ed..b22f686 100644 --- a/src/avr/src/line.c +++ b/src/avr/src/line.c @@ -53,14 +53,14 @@ typedef struct { static struct { - line_t line; - + float current_time; int section; bool stop_section; - float current_time; float offset_time; int seg; + line_t line; + float iD; // Initial section distance float iV; // Initial section velocity float iA; // Initial section acceleration @@ -266,7 +266,8 @@ static stat_t _line_exec() { void _print_vector(const char *name, float v[4]) { - printf("%s %f %f %f %f\n", name, v[0], v[1], v[2], v[3]); + printf("%s %f %f %f %f\n", + name, (double)v[0], (double)v[1], (double)v[2], (double)v[3]); } diff --git a/src/avr/src/motor.c b/src/avr/src/motor.c index 81cf475..8841d9f 100644 --- a/src/avr/src/motor.c +++ b/src/avr/src/motor.c @@ -50,6 +50,11 @@ typedef struct { // Config uint8_t axis; // map motor to axis + uint8_t step_pin; + uint8_t dir_pin; + TC0_t *timer; + DMA_CH_t *dma; + uint8_t dma_trigger; bool slave; uint16_t microsteps; // microsteps per full step bool reverse; @@ -59,11 +64,6 @@ typedef struct { float min_soft_limit; float max_soft_limit; bool homed; - uint8_t step_pin; - uint8_t dir_pin; - TC0_t *timer; - DMA_CH_t *dma; - uint8_t dma_trigger; // Computed float steps_per_unit; @@ -371,7 +371,8 @@ void set_power_mode(int motor, uint8_t value) { for (int m = motor; m < MOTORS; m++) if (motors[m].axis == motors[motor].axis) motors[m].power_mode = - value <= MOTOR_POWERED_ONLY_WHEN_MOVING ? value : MOTOR_DISABLED; + value <= MOTOR_POWERED_ONLY_WHEN_MOVING ? + (motor_power_mode_t)value : MOTOR_DISABLED; } diff --git a/src/avr/src/outputs.c b/src/avr/src/outputs.c index 80c7fdc..c8d1491 100644 --- a/src/avr/src/outputs.c +++ b/src/avr/src/outputs.c @@ -120,30 +120,30 @@ void outputs_stop() { // Var callbacks -uint8_t get_output_state(uint8_t id) { +uint8_t get_output_state(int id) { return OUTS <= id ? OUT_TRI : outputs[id].state; } -bool get_output_active(uint8_t id) { +bool get_output_active(int id) { return OUTS <= id ? false : outputs[id].active; } -void set_output_active(uint8_t id, bool active) { +void set_output_active(int id, bool active) { if (OUTS <= id) return; outputs[id].active = active; _update_state(&outputs[id]); } -uint8_t get_output_mode(uint8_t id) { +uint8_t get_output_mode(int id) { return OUTS <= id ? OUT_DISABLED : outputs[id].mode; } -void set_output_mode(uint8_t id, uint8_t mode) { +void set_output_mode(int id, uint8_t mode) { if (OUTS <= id) return; - outputs[id].mode = mode; + outputs[id].mode = (output_mode_t)mode; _update_state(&outputs[id]); } diff --git a/src/avr/src/seek.c b/src/avr/src/seek.c index ce3d71b..5dc6aa4 100644 --- a/src/avr/src/seek.c +++ b/src/avr/src/seek.c @@ -50,10 +50,10 @@ typedef struct { } seek_t; -static seek_t seek = {false, -1, 0}; +static seek_t seek = {false, SW_INVALID, 0}; -switch_id_t seek_get_switch() {return seek.active ? seek.sw : -1;} +switch_id_t seek_get_switch() {return seek.active ? seek.sw : SW_INVALID;} bool seek_switch_found() { @@ -85,11 +85,11 @@ void seek_cancel() {seek.active = false;} // Command callbacks stat_t command_seek(char *cmd) { - int8_t sw = decode_hex_nibble(cmd[1]); + switch_id_t sw = (switch_id_t)decode_hex_nibble(cmd[1]); if (sw <= 0) return STAT_INVALID_ARGUMENTS; // Don't allow seek to ESTOP if (!switch_is_enabled(sw)) return STAT_SEEK_NOT_ENABLED; - int8_t flags = decode_hex_nibble(cmd[2]); + uint8_t flags = decode_hex_nibble(cmd[2]); if (flags & 0xfc) return STAT_INVALID_ARGUMENTS; seek_t seek = {true, sw, flags}; diff --git a/src/avr/src/spindle.c b/src/avr/src/spindle.c index d9d53f8..bc931ad 100644 --- a/src/avr/src/spindle.c +++ b/src/avr/src/spindle.c @@ -91,7 +91,7 @@ void set_spindle_type(uint8_t value) { case SPINDLE_TYPE_HUANYANG: hy_deinit(); break; } - spindle.type = value; + spindle.type = (spindle_type_t)value; switch (spindle.type) { case SPINDLE_TYPE_DISABLED: break; diff --git a/src/avr/src/state.c b/src/avr/src/state.c index f7940f1..d39c010 100644 --- a/src/avr/src/state.c +++ b/src/avr/src/state.c @@ -41,16 +41,15 @@ static struct { - state_t state; - hold_reason_t hold_reason; - + bool flushing; + bool resuming; bool stop_requested; bool pause_requested; bool optional_pause_requested; bool unpause_requested; - bool flushing; - bool resuming; + state_t state; + hold_reason_t hold_reason; } s = { .flushing = true, // Start out flushing }; diff --git a/src/avr/src/status.c b/src/avr/src/status.c index 4241eb5..451267d 100644 --- a/src/avr/src/status.c +++ b/src/avr/src/status.c @@ -49,7 +49,7 @@ static const char *const stat_msg[] PROGMEM = { const char *status_to_pgmstr(stat_t code) { - return pgm_read_ptr(&stat_msg[code]); + return (const char *)pgm_read_ptr(&stat_msg[code]); } @@ -68,7 +68,7 @@ stat_t status_message_P(const char *location, status_level_t level, va_list args; // Type - printf_P(PSTR("\n{\"level\":\"%"PRPSTR"\",\"msg\":\""), + printf_P(PSTR("\n{\"level\":\"%" PRPSTR "\",\"msg\":\""), status_level_pgmstr(level)); // Message @@ -85,7 +85,7 @@ stat_t status_message_P(const char *location, status_level_t level, if (code) printf_P(PSTR(",\"code\":%d"), code); // Location - if (location) printf_P(PSTR(",\"where\":\"%"PRPSTR"\""), location); + if (location) printf_P(PSTR(",\"where\":\"%" PRPSTR "\""), location); putchar('}'); putchar('\n'); diff --git a/src/avr/src/switch.c b/src/avr/src/switch.c index 45eb3f7..4a8966d 100644 --- a/src/avr/src/switch.c +++ b/src/avr/src/switch.c @@ -90,7 +90,7 @@ void switch_rtc_callback() { s->state = state; s->debounce = 0; s->initialized = true; - if (s->cb) s->cb(i, switch_is_active(i)); + if (s->cb) s->cb((switch_id_t)i, switch_is_active((switch_id_t)i)); } } } @@ -143,7 +143,7 @@ uint8_t get_min_sw_mode(int index) {return switch_get_type(MIN_SWITCH(index));} void set_min_sw_mode(int index, uint8_t value) { - switch_set_type(MIN_SWITCH(index), value); + switch_set_type(MIN_SWITCH(index), (switch_type_t)value); } @@ -151,18 +151,28 @@ uint8_t get_max_sw_mode(int index) {return switch_get_type(MAX_SWITCH(index));} void set_max_sw_mode(int index, uint8_t value) { - switch_set_type(MAX_SWITCH(index), value); + switch_set_type(MAX_SWITCH(index), (switch_type_t)value); } uint8_t get_estop_mode() {return switch_get_type(SW_ESTOP);} -void set_estop_mode(uint8_t value) {switch_set_type(SW_ESTOP, value);} + + +void set_estop_mode(uint8_t value) { + switch_set_type(SW_ESTOP, (switch_type_t)value); +} + + uint8_t get_probe_mode() {return switch_get_type(SW_PROBE);} -void set_probe_mode(uint8_t value) {switch_set_type(SW_PROBE, value);} + + +void set_probe_mode(uint8_t value) { + switch_set_type(SW_PROBE, (switch_type_t)value); +} static uint8_t _get_state(int index) { - if (!switch_is_enabled(index)) return 2; // Disabled + if (!switch_is_enabled((switch_id_t)index)) return 2; // Disabled return switches[index].state; } diff --git a/src/avr/src/switch.h b/src/avr/src/switch.h index ef2a459..f3d85e1 100644 --- a/src/avr/src/switch.h +++ b/src/avr/src/switch.h @@ -35,8 +35,8 @@ // macros for finding the index into the switch table give the axis number -#define MIN_SWITCH(axis) (2 + axis * 2) -#define MAX_SWITCH(axis) (2 + axis * 2 + 1) +#define MIN_SWITCH(axis) ((switch_id_t)(2 + axis * 2)) +#define MAX_SWITCH(axis) ((switch_id_t)(2 + axis * 2 + 1)) typedef enum { @@ -48,6 +48,7 @@ typedef enum { /// Switch IDs typedef enum { + SW_INVALID = -1, SW_ESTOP, SW_PROBE, SW_MIN_X, SW_MAX_X, SW_MIN_Y, SW_MAX_Y, diff --git a/src/avr/src/type.c b/src/avr/src/type.c index d8b2326..73c01eb 100644 --- a/src/avr/src/type.c +++ b/src/avr/src/type.c @@ -52,7 +52,7 @@ str type_parse_str(const char *s) {return s;} // Program string bool type_eq_pstr(pstr a, pstr b) {return a == b;} -void type_print_pstr(pstr s) {printf_P(PSTR("\"%"PRPSTR"\""), s);} +void type_print_pstr(pstr s) {printf_P(PSTR("\"%" PRPSTR "\""), s);} const char *type_parse_pstr(const char *value) {return value;} float type_pstr_to_float(pstr s) {return 0;} @@ -116,12 +116,12 @@ float type_parse_f32(const char *value) { // bool -bool type_eq_bool(bool a, bool b) {return a == b;} -float type_bool_to_float(bool x) {return x;} -void type_print_bool(bool x) {printf_P(x ? PSTR("true") : PSTR("false"));} +bool type_eq_b8(bool a, bool b) {return a == b;} +float type_b8_to_float(bool x) {return x;} +void type_print_b8(bool x) {printf_P(x ? PSTR("true") : PSTR("false"));} -bool type_parse_bool(const char *value) { +bool type_parse_b8(const char *value) { return !strcasecmp(value, "true") || type_parse_f32(value); } @@ -129,35 +129,35 @@ bool type_parse_bool(const char *value) { // s8 bool type_eq_s8(s8 a, s8 b) {return a == b;} float type_s8_to_float(s8 x) {return x;} -void type_print_s8(s8 x) {printf_P(PSTR("%"PRIi8), x);} +void type_print_s8(s8 x) {printf_P(PSTR("%" PRIi8), x);} s8 type_parse_s8(const char *value) {return strtol(value, 0, 0);} // u8 bool type_eq_u8(u8 a, u8 b) {return a == b;} float type_u8_to_float(u8 x) {return x;} -void type_print_u8(u8 x) {printf_P(PSTR("%"PRIu8), x);} +void type_print_u8(u8 x) {printf_P(PSTR("%" PRIu8), x);} u8 type_parse_u8(const char *value) {return strtol(value, 0, 0);} // u16 bool type_eq_u16(u16 a, u16 b) {return a == b;} float type_u16_to_float(u16 x) {return x;} -void type_print_u16(u16 x) {printf_P(PSTR("%"PRIu16), x);} +void type_print_u16(u16 x) {printf_P(PSTR("%" PRIu16), x);} u16 type_parse_u16(const char *value) {return strtoul(value, 0, 0);} // s32 bool type_eq_s32(s32 a, s32 b) {return a == b;} float type_s32_to_float(s32 x) {return x;} -void type_print_s32(s32 x) {printf_P(PSTR("%"PRIi32), x);} +void type_print_s32(s32 x) {printf_P(PSTR("%" PRIi32), x);} s32 type_parse_s32(const char *value) {return strtol(value, 0, 0);} // u32 bool type_eq_u32(u32 a, u32 b) {return a == b;} float type_u32_to_float(u32 x) {return x;} -void type_print_u32(u32 x) {printf_P(PSTR("%"PRIu32), x);} +void type_print_u32(u32 x) {printf_P(PSTR("%" PRIu32), x);} u32 type_parse_u32(const char *value) {return strtol(value, 0, 0);} diff --git a/src/avr/src/type.def b/src/avr/src/type.def index 68f8330..53da1bf 100644 --- a/src/avr/src/type.def +++ b/src/avr/src/type.def @@ -25,10 +25,6 @@ \******************************************************************************/ -#ifdef bool -#undef bool -#endif - // TYPE DEF TYPEDEF(flags, uint16_t) TYPEDEF(str, const char *) @@ -39,4 +35,4 @@ TYPEDEF(s8, int8_t) TYPEDEF(u16, uint16_t) TYPEDEF(s32, int32_t) TYPEDEF(u32, uint32_t) -TYPEDEF(bool, _Bool) +TYPEDEF(b8, bool) diff --git a/src/avr/src/type.h b/src/avr/src/type.h index 8307c5a..1ec18d8 100644 --- a/src/avr/src/type.h +++ b/src/avr/src/type.h @@ -30,6 +30,7 @@ #include "pgmspace.h" #include +#include // Define types diff --git a/src/avr/src/usart.c b/src/avr/src/usart.c index 06a8e1a..2901703 100644 --- a/src/avr/src/usart.c +++ b/src/avr/src/usart.c @@ -34,6 +34,8 @@ #include #include +#include + // Ring buffers #define RING_BUF_NAME tx_buf @@ -93,9 +95,6 @@ static int _usart_putchar(char c, FILE *f) { } -static FILE _stdout = FDEV_SETUP_STREAM(_usart_putchar, 0, _FDEV_SETUP_WRITE); - - void usart_init(void) { // Setup ring buffer tx_buf_init(); @@ -123,6 +122,11 @@ void usart_init(void) { PMIC.CTRL |= PMIC_HILVLEN_bm; // Interrupt level on // Connect IO + static FILE _stdout; + memset(&_stdout, 0, sizeof(FILE)); + _stdout.put = _usart_putchar; + _stdout.flags = _FDEV_SETUP_WRITE; + stdout = &_stdout; stderr = &_stdout; diff --git a/src/avr/src/vars.c b/src/avr/src/vars.c index 736fca1..d925a29 100644 --- a/src/avr/src/vars.c +++ b/src/avr/src/vars.c @@ -324,8 +324,8 @@ float vars_get_number(const char *name) { void vars_print_json() { bool first = true; static const char fmt[] PROGMEM = - "\"%s\":{\"name\":\"%"PRPSTR"\",\"type\":\"%"PRPSTR"\"," - "\"help\":\"%"PRPSTR"\""; + "\"%s\":{\"name\":\"%" PRPSTR "\",\"type\":\"%" PRPSTR "\"," + "\"help\":\"%" PRPSTR "\""; static const char index_fmt[] PROGMEM = ",\"index\":\"%s\""; #define VAR(NAME, CODE, TYPE, INDEX, ...) \ @@ -393,7 +393,7 @@ stat_t command_sync_var(char *cmd) { unsigned command_sync_var_size() {return sizeof(var_cmd_t);} -void command_sync_var_exec(char *data) { +void command_sync_var_exec(void *data) { var_cmd_t *cmd = (var_cmd_t *)data; _set(cmd->type, cmd->index, cmd->set, cmd->value); } diff --git a/src/avr/src/vars.def b/src/avr/src/vars.def index f44fcc8..5e2c19e 100644 --- a/src/avr/src/vars.def +++ b/src/avr/src/vars.def @@ -39,7 +39,7 @@ VAR(power_mode, pm, u8, MOTORS, 1, 1, "Motor power mode") VAR(drive_current, dc, f32, MOTORS, 1, 1, "Max motor drive current") VAR(idle_current, ic, f32, MOTORS, 1, 1, "Motor idle current") -VAR(reverse, rv, u8, MOTORS, 1, 1, "Reverse motor polarity") +VAR(reverse, rv, b8, MOTORS, 1, 1, "Reverse motor polarity") VAR(microstep, mi, u16, MOTORS, 1, 1, "Microsteps per full step") VAR(velocity_max, vm, f32, MOTORS, 1, 1, "Maxium vel in mm/min") VAR(accel_max, am, f32, MOTORS, 1, 1, "Maxium accel in mm/min^2") @@ -49,16 +49,16 @@ VAR(travel, tr, f32, MOTORS, 1, 1, "Travel in mm/rev") VAR(min_soft_limit, tn, f32, MOTORS, 1, 1, "Min soft limit") VAR(max_soft_limit, tm, f32, MOTORS, 1, 1, "Max soft limit") -VAR(homed, h, bool, MOTORS, 1, 1, "Motor homed status") +VAR(homed, h, b8, MOTORS, 1, 1, "Motor homed status") VAR(active_current, ac, f32, MOTORS, 0, 1, "Motor current now") VAR(driver_flags, df, u16, MOTORS, 0, 1, "Motor driver flags") VAR(status_strings, ds, flags, MOTORS, 0, 1, "Motor driver status") -VAR(driver_stalled, sl, bool, MOTORS, 0, 1, "Motor driver status") +VAR(driver_stalled, sl, b8, MOTORS, 0, 1, "Motor driver status") VAR(encoder, en, s32, MOTORS, 0, 0, "Motor encoder") VAR(error, ee, s32, MOTORS, 0, 0, "Motor position error") -VAR(motor_fault, fa, bool, 0, 0, 1, "Motor fault status") +VAR(motor_fault, fa, b8, 0, 0, 1, "Motor fault status") // Switches VAR(min_sw_mode, ls, u8, MOTORS, 1, 1, "Minimum switch mode") @@ -74,7 +74,7 @@ VAR(probe_switch, pw, u8, 0, 0, 1, "Probe switch state") VAR(axis_position, p, f32, AXES, 0, 1, "Axis position") // Outputs -VAR(output_active, oa, bool, OUTS, 1, 1, "Output pin active") +VAR(output_active, oa, b8, OUTS, 1, 1, "Output pin active") VAR(output_state, os, u8, OUTS, 0, 1, "Output pin state") VAR(output_mode, om, u8, OUTS, 1, 1, "Output pin mode") @@ -83,7 +83,7 @@ VAR(analog_input, ai, f32, ANALOG, 0, 0, "Analog input pins") // Spindle VAR(spindle_type, st, u8, 0, 1, 1, "DISABLED=0, PWM=1 or HUANYANG=2") -VAR(spin_reversed, sr, bool, 0, 1, 1, "Reverse spin") +VAR(spin_reversed, sr, b8, 0, 1, 1, "Reverse spin") VAR(max_spin, sx, f32, 0, 1, 1, "Maximum spindle speed") VAR(min_spin, sm, f32, 0, 1, 1, "Minimum spindle speed") VAR(pwm_min_duty, nd, f32, 0, 1, 1, "Minimum PWM duty cycle") @@ -92,7 +92,7 @@ VAR(pwm_duty, pd, f32, 0, 0, 1, "Current PWM duty cycle") VAR(pwm_freq, sf, u16, 0, 1, 1, "Spindle PWM frequency in Hz") // PWM spindle -VAR(pwm_invert, pi, bool, 0, 1, 1, "Inverted spindle PWM") +VAR(pwm_invert, pi, b8, 0, 1, 1, "Inverted spindle PWM") // Huanyang spindle VAR(hy_id, hi, u8, 0, 1, 1, "Huanyang ID") @@ -104,22 +104,22 @@ VAR(hy_max_freq, hx, f32, 0, 0, 1, "Huanyang max freq") VAR(hy_min_freq, hm, f32, 0, 0, 1, "Huanyang min freq") VAR(hy_rated_rpm, hq, u16, 0, 0, 1, "Huanyang rated RPM") VAR(hy_status, hs, u8, 0, 0, 1, "Huanyang status flags") -VAR(hy_debug, hb, bool, 0, 1, 1, "Huanyang debugging") -VAR(hy_connected, he, bool, 0, 0, 1, "Huanyang connected") +VAR(hy_debug, hb, b8, 0, 1, 1, "Huanyang debugging") +VAR(hy_connected, he, b8, 0, 0, 1, "Huanyang connected") // Machine state VAR(id, id, u32, 0, 1, 1, "Last executed command ID") VAR(speed, s, f32, 0, 1, 1, "Current spindle speed") VAR(feed_override, fo, f32, 0, 1, 1, "Feed rate override") VAR(speed_override, so, f32, 0, 1, 1, "Spindle speed override") -VAR(optional_pause, op, bool, 0, 1, 1, "Optional pause state") +VAR(optional_pause, op, b8, 0, 1, 1, "Optional pause state") // System VAR(velocity, v, f32, 0, 0, 1, "Current velocity") VAR(acceleration, ax, f32, 0, 0, 1, "Current acceleration") VAR(jerk, j, f32, 0, 0, 1, "Current jerk") VAR(hw_id, hid, str, 0, 0, 1, "Hardware ID") -VAR(estop, es, bool, 0, 1, 1, "Emergency stop") +VAR(estop, es, b8, 0, 1, 1, "Emergency stop") VAR(estop_reason, er, pstr, 0, 0, 1, "Emergency stop reason") VAR(state, xx, pstr, 0, 0, 1, "Machine state") VAR(hold_reason, pr, pstr, 0, 0, 1, "Machine pause reason") -- 2.27.0