Skip to content

Commit 1825cf9

Browse files
committed
replaced define double click upper bound with struct variable
1 parent ad3f750 commit 1825cf9

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

BUILD_DIR/main.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "esos_pic24.h"
55
//#include "esos_pic24_rs232.h"
66
#include <p33EP512GP806.h>
7-
//#include <pic24_all.h>
7+
#include <pic24_all.h>
88
#include "esos_f14ui.h"
99
#include <stdio.h>
1010
#include <stdlib.h>
@@ -55,12 +55,11 @@ ESOS_USER_TASK(drawDisplay) {
5555
} else {
5656
outString("CCW");
5757
}
58-
5958
if (esos_uiF14_isRPGTurningSlow()) {
6059
outString(" Slowly\n");
6160
} else if (esos_uiF14_isRPGTurningMedium()) {
6261
outString(" Mediumly\n");
63-
} else (esos_uiF14_isRPGTurningFast()) {
62+
} else {
6463
outString(" Fastly\n");
6564
}
6665
} else {

esos/src/esos_f14ui.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#define MINIMUM_LED_FLASH_PERIOD 100
1212

13-
#define DOUBLE_PRESS_UPPER_BOUND_TICKS = 25
13+
1414

1515
// PRIVATE FUNCTIONS
1616
inline void _esos_uiF14_setRPGCounter (int16_t i16_newValue) {
@@ -385,13 +385,13 @@ ESOS_USER_TASK( __esos_uiF14_task ){
385385
}
386386

387387
/* SWITCH STATE LOGIC */
388-
if (SW1_PRESSED || SW1_doublepress_counter >= DOUBLE_PRESS_UPPER_BOUND_TICKS) {
389-
if (SW1_doublepress_counter >= DOUBLE_PRESS_UPPER_BOUND_TICKS) {
388+
if (SW1_PRESSED || SW1_doublepress_counter >= _st_esos_uiF14Data.u16_doublePressUpperMs) {
389+
if (SW1_doublepress_counter >= _st_esos_uiF14Data.u16_doublePressUpperMs) {
390390
SW1_doublepress_counter = -1; // Counter expired, no double press event, disable counter
391391
_st_esos_uiF14Data.b_SW1DoublePressed = FALSE;
392392
_st_esos_uiF14Data.b_SW1Pressed = TRUE;
393393
// Switch was pressed while counter was running and not expired
394-
} else if (SW1_doublepress_counter < DOUBLE_PRESS_UPPER_BOUND_TICKS && SW1_doublepress_counter != -1) {
394+
} else if (SW1_doublepress_counter < _st_esos_uiF14Data.u16_doublePressUpperMs && SW1_doublepress_counter != -1) {
395395
_st_esos_uiF14Data.b_SW1DoublePressed = TRUE;
396396
_st_esos_uiF14Data.b_SW1Pressed = FALSE;
397397
// Otherwise, the switch was pressed, start the timer
@@ -400,13 +400,13 @@ ESOS_USER_TASK( __esos_uiF14_task ){
400400
}
401401
}
402402

403-
if (SW2_PRESSED || SW2_doublepress_counter >= DOUBLE_PRESS_UPPER_BOUND_TICKS) {
404-
if (SW2_doublepress_counter >= DOUBLE_PRESS_UPPER_BOUND_TICKS) {
403+
if (SW2_PRESSED || SW2_doublepress_counter >= _st_esos_uiF14Data.u16_doublePressUpperMs) {
404+
if (SW2_doublepress_counter >= _st_esos_uiF14Data.u16_doublePressUpperMs) {
405405
SW2_doublepress_counter = -1; // Counter expired, no double press event, disable counter
406406
_st_esos_uiF14Data.b_SW2DoublePressed = FALSE;
407407
_st_esos_uiF14Data.b_SW2Pressed = TRUE;
408408
// Switch was pressed while counter was running and not expired
409-
} else if (SW2_doublepress_counter < DOUBLE_PRESS_UPPER_BOUND_TICKS && SW2_doublepress_counter != -1) {
409+
} else if (SW2_doublepress_counter < _st_esos_uiF14Data.u16_doublePressUpperMs && SW2_doublepress_counter != -1) {
410410
_st_esos_uiF14Data.b_SW2DoublePressed = TRUE;
411411
_st_esos_uiF14Data.b_SW2Pressed = FALSE;
412412
// Otherwise, the switch was pressed, start the timer
@@ -415,13 +415,13 @@ ESOS_USER_TASK( __esos_uiF14_task ){
415415
}
416416
}
417417

418-
if (SW3_PRESSED || SW3_doublepress_counter >= DOUBLE_PRESS_UPPER_BOUND_TICKS) {
419-
if (SW3_doublepress_counter >= DOUBLE_PRESS_UPPER_BOUND_TICKS) {
418+
if (SW3_PRESSED || SW3_doublepress_counter >= _st_esos_uiF14Data.u16_doublePressUpperMs) {
419+
if (SW3_doublepress_counter >= _st_esos_uiF14Data.u16_doublePressUpperMs) {
420420
SW3_doublepress_counter = -1; // Counter expired, no double press event, disable counter
421421
_st_esos_uiF14Data.b_SW3DoublePressed = FALSE;
422422
_st_esos_uiF14Data.b_SW3Pressed = TRUE;
423423
// Switch was pressed while counter was running and not expired
424-
} else if (SW3_doublepress_counter < DOUBLE_PRESS_UPPER_BOUND_TICKS && SW3_doublepress_counter != -1) {
424+
} else if (SW3_doublepress_counter < _st_esos_uiF14Data.u16_doublePressUpperMs && SW3_doublepress_counter != -1) {
425425
_st_esos_uiF14Data.b_SW3DoublePressed = TRUE;
426426
_st_esos_uiF14Data.b_SW3Pressed = FALSE;
427427
// Otherwise, the switch was pressed, start the timer

0 commit comments

Comments
 (0)