Switch to C++ compiler
authorJoseph Coffland <joseph@cauldrondevelopment.com>
Thu, 8 Mar 2018 07:23:59 +0000 (23:23 -0800)
committerJoseph Coffland <joseph@cauldrondevelopment.com>
Thu, 8 Mar 2018 07:23:59 +0000 (23:23 -0800)
22 files changed:
src/avr/Makefile
src/avr/src/command.c
src/avr/src/commands.c
src/avr/src/drv8711.c
src/avr/src/estop.c
src/avr/src/exec.c
src/avr/src/io.c
src/avr/src/line.c
src/avr/src/motor.c
src/avr/src/outputs.c
src/avr/src/seek.c
src/avr/src/spindle.c
src/avr/src/state.c
src/avr/src/status.c
src/avr/src/switch.c
src/avr/src/switch.h
src/avr/src/type.c
src/avr/src/type.def
src/avr/src/type.h
src/avr/src/usart.c
src/avr/src/vars.c
src/avr/src/vars.def

index d23221650901029284161b86e6444665bfbcc498..bf6bbe741a7ae56b43a91ab9f6ec65f5cf94cdad 100644 (file)
@@ -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
index d9e77800297959554e9096f95866bb23eafe7f2f..ec8229d6fd2d4b9b290906b83d373d4331c83446 100644 (file)
@@ -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(',');                          \
index 59ad978d01a1e0da59d72ade52dc6e4a3242b0e2..fea4a808ef6ad9e81e6c240ac2ca47514ce33a02 100644 (file)
@@ -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
 }
 
index 9deaf5b90ff99b724fb72a9fcf9ac31b9a5d009b..37583d733fff9d910c3af3f47b102e87f5a5c3ff 100644 (file)
@@ -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;
 
 
index c9335600a1d19f99a4b14616528fd7978ce8bd4f..be2aebc4f75b623990071d4908ac150d7d10a663 100644 (file)
@@ -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);
 }
 
 
index 68614cf4bb16be10dc9d6a7b71a262ef83365c8d..2ffc957a43a326df3e4c9c40d3a4caf22f0df172 100644 (file)
@@ -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;
index db2325be29cd6365690dc591338095036b63d495..42b52ce299ead6d3c9874949a6c5cf9799ad590a 100644 (file)
@@ -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++;
 
index de219ed56c06f49f888965a139c43e2a46979db8..b22f6868086be35f85468b5e281fc7d483c86e2d 100644 (file)
@@ -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]);
 }
 
 
index 81cf475ca5b74c1f0bf6ec10856b429a10fb4c83..8841d9f80eb185a57f60382a56f93a0c05a62919 100644 (file)
 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;
 }
 
 
index 80c7fdc8553b74bb7b1a7833ccae0522edbbf097..c8d1491f16ea2ac191a5d6fe4cdb90a1dda8c6ad 100644 (file)
@@ -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]);
 }
index ce3d71bbfe0bbf9868bff9001e9157da1e757e90..5dc6aa4eb278a51e93e7ddbd8b57018deea0659a 100644 (file)
@@ -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};
index d9d53f81165333bba78eb46a0865d4c22f1cc2f9..bc931ad36b73530e9e89c28708029ab566dc9331 100644 (file)
@@ -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;
index f7940f128df6cdaf43729694ea8cfffc27c124f5..d39c010c16732d5d971a475901e876f58afd3dd2 100644 (file)
 
 
 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
 };
index 4241eb55369bd742e68dcf96bbdecf8384b8bd44..451267dd382ff75316292efb9a1a883f67b73767 100644 (file)
@@ -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');
index 45eb3f79141aacd8b26b9e39d4f888821d7be104..4a8966d19b9cc5d3fdf62462e934259d705ec595 100644 (file)
@@ -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;
 }
 
index ef2a459e7331a229c68170c414f7eb727f2d9917..f3d85e17a5e0b92a1d373540259b2af1b77257a8 100644 (file)
@@ -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,
index d8b232662f9aa751a25f00d992bb922acf4a6dbd..73c01eb446b48ed80747acb6d1536c39d9d0c3ab 100644 (file)
@@ -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);}
 
 
index 68f8330fd5124c53e07822229028761df27e4247..53da1bfb476a64f8ad53688b42b850f037e118ae 100644 (file)
 
 \******************************************************************************/
 
-#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)
index 8307c5acafc52004b7de6a5a8be6f9883ffcb3ed..1ec18d8480fa268e037bb5084d8a25b4c8413bb2 100644 (file)
@@ -30,6 +30,7 @@
 #include "pgmspace.h"
 
 #include <stdint.h>
+#include <stdbool.h>
 
 
 // Define types
index 06a8e1af816d7c20c0d62f61d4bf7617d249af1d..29017032e4c1fc2499d51c9a8f4a0bb227f5499f 100644 (file)
@@ -34,6 +34,8 @@
 
 #include <stdio.h>
 #include <stdbool.h>
+#include <string.h>
+
 
 // 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;
 
index 736fca1e1d0a458c9ce1a4dc7516b15c6709e589..d925a29a96c5d0ce5f8869b087fa27353f40583f 100644 (file)
@@ -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);
 }
index f44fcc816261b72a8aa91640d89f1f63b9bbd27b..5e2c19e6e54931fa878867b270f9ecc3a2f93fa9 100644 (file)
@@ -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")