Skip to content

Commit 3b4efa2

Browse files
committed
Remove INCLUDE_PROTOCOL2 and update platformio.ini
1 parent 84993d5 commit 3b4efa2

File tree

4 files changed

+9
-20
lines changed

4 files changed

+9
-20
lines changed

inc/config.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -374,12 +374,9 @@
374374
#endif
375375

376376
// ############################### SERIAL PROTOCOL ###############################
377-
#define NO_PROTOCOL 0
378-
#define INCLUDE_PROTOCOL2 2 // enables processing of input characters through 'machine_protocol.c'
379377

380-
//#define INCLUDE_PROTOCOL NO_PROTOCOL
381378
#ifndef INCLUDE_PROTOCOL
382-
#define INCLUDE_PROTOCOL INCLUDE_PROTOCOL2
379+
#define INCLUDE_PROTOCOL 1 // set to 0 to disable, 1 to enable
383380
#endif
384381
// Log PWM value in position/speed control mode
385382
//define LOG_PWM

platformio.ini

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -217,15 +217,7 @@ build_flags =
217217
-Wl,-lm
218218
-Og
219219
# -Wl,-lnosys
220-
-D IGNORE_GLOBAL_CONFIG
221-
222-
-D SERIAL_USART2_IT
223-
-D USART2_BAUD=115200 ; UART baud rate
224-
-D USART2_WORDLENGTH=UART_WORDLENGTH_8B ; UART_WORDLENGTH_8B or UART_WORDLENGTH_9B
225-
-D SERIAL_USART_IT_BUFFERTYPE='unsigned char' ; char or short
226-
227-
-D FLASH_STORAGE
228-
-D HALL_INTERRUPTS
220+
-D CONTROL_TYPE=2
229221

230222
-D ENABLE_INACTIVITY_TIMEOUT=0
231223
-D BEEPS_ON_OFF=0

src/hbprotocol

src/main.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ int main(void) {
408408

409409
// delay until we should start processing
410410
while (timeStats.now_us < timeStats.start_processing_us){
411-
#if (INCLUDE_PROTOCOL == INCLUDE_PROTOCOL2)
411+
#if (INCLUDE_PROTOCOL)
412412
#ifdef SOFTWARE_SERIAL
413413
while ( softwareserial_available() > 0 ) {
414414
protocol_byte( &sSoftwareSerial, (unsigned char) softwareserial_getrx() );
@@ -621,7 +621,7 @@ int main(void) {
621621

622622
#endif // READ_SENSOR
623623

624-
#if defined(INCLUDE_PROTOCOL)||defined(READ_SENSOR)
624+
#if INCLUDE_PROTOCOL||defined(READ_SENSOR)
625625
if (!sensor_control || !FlashContent.HoverboardEnable){
626626
if ((last_control_type != control_type) || (!enable)){
627627
// nasty things happen if it's not re-initialised
@@ -718,18 +718,16 @@ int main(void) {
718718
sensor_send_lights();
719719
#endif
720720

721-
#endif // INCLUDE_PROTOCOL)||defined(READ_SENSOR)
721+
#endif // INCLUDE_PROTOCOL or READ_SENSOR
722722

723723
// ####### LOW-PASS FILTER #######
724724
steer = steer * (1.0 - FILTER) + cmd1 * FILTER;
725725
speed = speed * (1.0 - FILTER) + cmd2 * FILTER;
726726

727727

728728
// ####### MIXER #######
729-
#ifdef INCLUDE_PROTOCOL
729+
#if (INCLUDE_PROTOCOL)
730730
if(ADCcontrolActive) {
731-
#else
732-
if(1) {
733731
#endif
734732

735733
if(ADC_TANKMODE && ADCcontrolActive) {
@@ -739,7 +737,9 @@ int main(void) {
739737
pwms[0] = CLAMP(speed * SPEED_COEFFICIENT - steer * STEER_COEFFICIENT, -1000, 1000);
740738
pwms[1] = CLAMP(speed * SPEED_COEFFICIENT + steer * STEER_COEFFICIENT, -1000, 1000);
741739
}
740+
#if (INCLUDE_PROTOCOL)
742741
}
742+
#endif
743743

744744
if(SWITCH_WHEELS) {
745745
int tmppwm = pwms[1];

0 commit comments

Comments
 (0)