Skip to content

Commit 5cf1160

Browse files
committed
#45: Tests for mode handler timeout and active handling
1 parent 2755b8d commit 5cf1160

File tree

2 files changed

+257
-39
lines changed

2 files changed

+257
-39
lines changed

Src/Application/mode_handler.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
enum {
1313
IMU_TIMEOUT = (uint16_t) (100 / 16.384),
14-
FLIGHTCOMPUTER_TIMOUT = (uint16_t) ((2 * 100) / 16.384),
15-
REMOTE_TIMEOUT = (uint16_t) (200 / 16.384),
14+
FLIGHTCOMPUTER_TIMEOUT = (uint16_t) ((2 * 100) / 16.384),
15+
REMOTE_TIMEOUT = (uint16_t) (100 / 16.384),
1616
};
1717

1818
static uint8_t imu_timeout_counter;
@@ -21,7 +21,7 @@ static uint8_t remote_timeout_counter;
2121

2222
void mode_handler_init(void) {
2323
imu_timeout_counter = IMU_TIMEOUT;
24-
flightcomputer_timeout_counter = FLIGHTCOMPUTER_TIMOUT;
24+
flightcomputer_timeout_counter = FLIGHTCOMPUTER_TIMEOUT;
2525
remote_timeout_counter = REMOTE_TIMEOUT;
2626
}
2727

@@ -60,8 +60,8 @@ mode_handler_mode_t mode_handler_handle(imu_data_t *imu_data, remote_data_t *rem
6060
flightcomputer_timeout_counter = 0;
6161
}
6262
bool flightcomputer_active = true;
63-
if (flightcomputer_timeout_counter >= FLIGHTCOMPUTER_TIMOUT) {
64-
flightcomputer_timeout_counter = FLIGHTCOMPUTER_TIMOUT;
63+
if (flightcomputer_timeout_counter >= FLIGHTCOMPUTER_TIMEOUT) {
64+
flightcomputer_timeout_counter = FLIGHTCOMPUTER_TIMEOUT;
6565
flightcomputer_active = false;
6666
}
6767
*flightcomputer_setpoint = flightcomputer_get_setpoint();

0 commit comments

Comments
 (0)