diff --git a/inc/config.h b/inc/config.h index 384f199..42a7798 100644 --- a/inc/config.h +++ b/inc/config.h @@ -374,12 +374,9 @@ #endif // ############################### SERIAL PROTOCOL ############################### -#define NO_PROTOCOL 0 -#define INCLUDE_PROTOCOL2 2 // enables processing of input characters through 'machine_protocol.c' -//#define INCLUDE_PROTOCOL NO_PROTOCOL #ifndef INCLUDE_PROTOCOL - #define INCLUDE_PROTOCOL INCLUDE_PROTOCOL2 + #define INCLUDE_PROTOCOL 1 // set to 0 to disable, 1 to enable #endif // Log PWM value in position/speed control mode //define LOG_PWM diff --git a/platformio.ini b/platformio.ini index 0f07dcd..b27a81c 100644 --- a/platformio.ini +++ b/platformio.ini @@ -217,15 +217,7 @@ build_flags = -Wl,-lm -Og # -Wl,-lnosys - -D IGNORE_GLOBAL_CONFIG - - -D SERIAL_USART2_IT - -D USART2_BAUD=115200 ; UART baud rate - -D USART2_WORDLENGTH=UART_WORDLENGTH_8B ; UART_WORDLENGTH_8B or UART_WORDLENGTH_9B - -D SERIAL_USART_IT_BUFFERTYPE='unsigned char' ; char or short - - -D FLASH_STORAGE - -D HALL_INTERRUPTS + -D CONTROL_TYPE=2 -D ENABLE_INACTIVITY_TIMEOUT=0 -D BEEPS_ON_OFF=0 diff --git a/src/hbprotocol b/src/hbprotocol index fe96935..66ad267 160000 --- a/src/hbprotocol +++ b/src/hbprotocol @@ -1 +1 @@ -Subproject commit fe96935cb2f550110ffaaa6d74852bedd79e25c7 +Subproject commit 66ad267195fbbe22cc0e18afab4016d37dd137d8 diff --git a/src/main.c b/src/main.c index a8cea26..73ed827 100644 --- a/src/main.c +++ b/src/main.c @@ -408,7 +408,7 @@ int main(void) { // delay until we should start processing while (timeStats.now_us < timeStats.start_processing_us){ - #if (INCLUDE_PROTOCOL == INCLUDE_PROTOCOL2) + #if (INCLUDE_PROTOCOL) #ifdef SOFTWARE_SERIAL while ( softwareserial_available() > 0 ) { protocol_byte( &sSoftwareSerial, (unsigned char) softwareserial_getrx() ); @@ -621,7 +621,7 @@ int main(void) { #endif // READ_SENSOR - #if defined(INCLUDE_PROTOCOL)||defined(READ_SENSOR) + #if INCLUDE_PROTOCOL||defined(READ_SENSOR) if (!sensor_control || !FlashContent.HoverboardEnable){ if ((last_control_type != control_type) || (!enable)){ // nasty things happen if it's not re-initialised @@ -718,7 +718,7 @@ int main(void) { sensor_send_lights(); #endif - #endif // INCLUDE_PROTOCOL)||defined(READ_SENSOR) + #endif // INCLUDE_PROTOCOL or READ_SENSOR // ####### LOW-PASS FILTER ####### steer = steer * (1.0 - FILTER) + cmd1 * FILTER; @@ -726,10 +726,8 @@ int main(void) { // ####### MIXER ####### - #ifdef INCLUDE_PROTOCOL + #if (INCLUDE_PROTOCOL) if(ADCcontrolActive) { - #else - if(1) { #endif if(ADC_TANKMODE && ADCcontrolActive) { @@ -739,7 +737,9 @@ int main(void) { pwms[0] = CLAMP(speed * SPEED_COEFFICIENT - steer * STEER_COEFFICIENT, -1000, 1000); pwms[1] = CLAMP(speed * SPEED_COEFFICIENT + steer * STEER_COEFFICIENT, -1000, 1000); } + #if (INCLUDE_PROTOCOL) } + #endif if(SWITCH_WHEELS) { int tmppwm = pwms[1];