Skip to content

Commit 34d7d70

Browse files
author
Bjoern Schmidt
committed
minor changes, see last commit ...
1 parent 53bd5f5 commit 34d7d70

File tree

6 files changed

+14
-31
lines changed

6 files changed

+14
-31
lines changed

ACAcommons.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,10 @@ void updatePasStatus(void) {
258258

259259
void updateSlowLoopStates(void) {
260260

261+
if (ui16_no_pass_counter < 64000){
262+
ui16_no_pass_counter++;
263+
}
264+
261265
if (ui16_motor_speed_erps == 0) {
262266
if (ui16_idle_counter < 64000){
263267
ui16_idle_counter++;
@@ -267,13 +271,15 @@ void updateSlowLoopStates(void) {
267271
}
268272

269273
// debug only
274+
ui8_variableDebugC = ui16_no_pass_counter>>8;
270275
ui8_variableDebugA = ui16_passcode;
271276
ui8_variableDebugB = ui16_passcode >>8;
272277

273278
//disable lock if passcode is not at least 4 digits
274279
if (ui16_passcode < 1001){
275280
ui8_lockstatus = 16;
276-
}else if (((ui16_aca_flags & IDLE_LOCKS_CONTROLLER) == IDLE_LOCKS_CONTROLLER) && (ui16_idle_counter > 3000)) {
281+
ui16_no_pass_counter =0;
282+
}else if (ui16_no_pass_counter > 3000) {
277283
//lock after 60 seconds idle
278284
ui8_lockstatus = 255;
279285
}

ACAcontrollerState.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ uint16_t ui16_time_ticks_for_uart_timeout = 0;
109109
uint8_t ui8_SPEED_Flag = 0; //flag for SPEED interrupt
110110
uint8_t ui8_offroad_counter = 0; //counter for offroad switching procedure
111111
uint16_t ui16_idle_counter = 0;
112+
uint16_t ui16_no_pass_counter = 3000;
112113
uint16_t ui16_passcode = 0;
113114
uint8_t ui8_lockstatus = 255;
114115

ACAcontrollerState.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ extern uint8_t ui8_SPEED_Flag; //Flag for PAS Interrupt detected
8787
extern uint16_t ui16_time_ticks_between_speed_interrupt; //Speed duration of one wheel revolution (tics * 64us)
8888
extern uint8_t ui8_offroad_counter;
8989
extern uint16_t ui16_idle_counter;
90+
extern uint16_t ui16_no_pass_counter;
9091
extern uint16_t ui16_passcode;
9192
extern uint8_t ui8_lockstatus;
9293

@@ -153,7 +154,6 @@ typedef enum {
153154
TQ_SENSOR_MODE = ((uint16_t) 2048),
154155
ANGLE_CORRECTION_ENABLED = ((uint16_t) 4096),
155156

156-
IDLE_LOCKS_CONTROLLER = ((uint16_t) 8192),
157157
IDLE_DISABLES_OFFROAD = ((uint16_t) 16384)
158158

159159

BOdisplay.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ void digestConfigRequest(uint8_t configAddress, uint8_t requestedCodeLowByte, ui
289289
addPayload(requestedCodeLowByte, ui16_passcode);
290290
}else if ((configAddress != EEPROM_ADDRESS) && (ui16_passcode == (((uint16_t) requestedValueHighByte << 8)+(uint16_t) requestedValue))){
291291
// unlock if correct code was sent
292+
ui16_no_pass_counter = 0;
292293
ui8_lockstatus = 16;
293294
addPayload(CODE_PASSCODE_HIGH_BYTE, ui16_passcode >> 8);
294295
addPayload(requestedCodeLowByte, ui16_passcode);

config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
#define TQS_CALIB 0.0
5353
#define ACA 4764
5454
#define EEPROM_NOINIT // eeprom will not be cleared
55-
#define EEPROM_INIT_MAGIC_BYTE 85 // makes sure (chance of fail 1/255) eeprom is invalidated after flashing new config
55+
#define EEPROM_INIT_MAGIC_BYTE 123 // makes sure (chance of fail 1/255) eeprom is invalidated after flashing new config
5656
#define ADC_BATTERY_VOLTAGE_K 68
5757
#define ACA_EXPERIMENTAL 128
5858
#define BATTERY_VOLTAGE_MAX_VALUE 200

nbproject/private/private.xml

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,37 +27,12 @@
2727
<file>file:/home/overlord/workspaces/Osec/ACAcommons.h</file>
2828
</group>
2929
<group>
30-
<file>file:/G:/osebikefw/config.h</file>
30+
<file>file:/G:/osebikefw/ACAcommons.c</file>
3131
<file>file:/G:/osebikefw/BOdisplay.c</file>
32-
<file>file:/G:/osebikefw/ACAeeprom.c</file>
33-
<file>file:/G:/osebikefw/StdPeriphLib/inc/stm8s.h</file>
34-
<file>file:/G:/osebikefw/Start_Compiling.bat</file>
35-
<file>file:/G:/osebikefw/ACAcontrollerState.c</file>
3632
<file>file:/G:/osebikefw/BOdisplay.h</file>
37-
<file>file:/G:/osebikefw/ACAcontrollerState.h</file>
38-
<file>file:/G:/osebikefw/ACAcommons.h</file>
39-
<file>file:/G:/osebikefw/motor.c</file>
40-
<file>file:/G:/osebikefw/Makefile_linux</file>
41-
<file>file:/G:/osebikefw/StdPeriphLib/src/stm8s_tim1.c</file>
42-
<file>file:/G:/osebikefw/WriteOptionBytes.bat</file>
43-
<file>file:/G:/osebikefw/timers.c</file>
33+
<file>file:/G:/osebikefw/ACAcontrollerState.c</file>
4434
<file>file:/G:/osebikefw/ACAeeprom.h</file>
45-
<file>file:/G:/osebikefw/Makefile_windows</file>
46-
<file>file:/G:/osebikefw/motor.h</file>
47-
<file>file:/G:/osebikefw/display_kingmeter.h</file>
48-
<file>file:/G:/osebikefw/pwm.c</file>
49-
<file>file:/G:/osebikefw/main.c</file>
50-
<file>file:/G:/osebikefw/cruise_control.c</file>
51-
<file>file:/G:/osebikefw/display_kingmeter.c</file>
52-
<file>file:/G:/osebikefw/main.h</file>
53-
<file>file:/G:/osebikefw/ACAsetPoint.c</file>
54-
<file>file:/G:/osebikefw/gpio.c</file>
55-
<file>file:/G:/osebikefw/uart.c</file>
56-
<file>file:/G:/osebikefw/gpio.h</file>
57-
<file>file:/G:/osebikefw/brake.c</file>
58-
<file>file:/G:/osebikefw/adc.c</file>
59-
<file>file:/G:/osebikefw/cruise_control.h</file>
60-
<file>file:/G:/osebikefw/display.c</file>
35+
<file>file:/G:/osebikefw/ACAcommons.h</file>
6136
</group>
6237
</open-files>
6338
</project-private>

0 commit comments

Comments
 (0)