Skip to content

Commit

Permalink
Remove INCLUDE_PROTOCOL2 and update platformio.ini
Browse files Browse the repository at this point in the history
  • Loading branch information
EmerickH committed Aug 6, 2019
1 parent 84993d5 commit 3b4efa2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 20 deletions.
5 changes: 1 addition & 4 deletions inc/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 1 addition & 9 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/hbprotocol
12 changes: 6 additions & 6 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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() );
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -718,18 +718,16 @@ 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;
speed = speed * (1.0 - FILTER) + cmd2 * FILTER;


// ####### MIXER #######
#ifdef INCLUDE_PROTOCOL
#if (INCLUDE_PROTOCOL)
if(ADCcontrolActive) {
#else
if(1) {
#endif

if(ADC_TANKMODE && ADCcontrolActive) {
Expand All @@ -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];
Expand Down

0 comments on commit 3b4efa2

Please # to comment.