6#include <elapsedMillis.h>
19 for (
int i = 0; i < n; i++) {
26 for (
int i = 0; i < n - 1; i++) {
27 buffer[i] = buffer[i + 1];
29 buffer[n - 1] = value;
37 if (v_apps1 < v_apps2)
53 int plausibility_value = abs(v2_expected - v_apps1) * 100 / v_apps1;
71 if (torqueVal > appsMax)
73 if (torqueVal < appsMin)
77 torqueVal = map(torqueVal, appsMin, appsMax, bamoMin, bamoMax);
94 INFO(
"APPS1: %d\tAPPS2: %d\t", v_apps1, v_apps2);
101 ERROR(
"APPS Implausible\n");
112 INFO(
"Plausible\t Torque Request:%d\t", bamocarValue);
116 LOG(
"APPS Blocked\n");
117 if (bamocarValue == 0) {
119 LOG(
"APPS Available\n");
124 float pedalTravelPercent = ((float)bamocarValue /
BAMOCAR_MAX) * 100.0;
127 INFO(
"Travel \%: %.2f\tBrake Val: %d\tBrake Timer: ", pedalTravelPercent,
brakeValue);
133 ERROR(
"APPS and Brake Implausible\n");
bool plausibility(int v_apps1, int v_apps2)
elapsedMillis appsBrakePlausibilityTimer
void bufferInsert(int *buffer, int n, int value)
elapsedMillis appsImplausibilityTimer
volatile uint16_t brakeValue
int scaleApps2(int apps2)
int avgBuffer2[AVG_SAMPLES]
int convertToBamocarScale(int apps1, int apps2)
int avgBuffer1[AVG_SAMPLES]
#define APPS_1_LOWER_BOUND
#define APPS_MAX_ERROR_ABS
#define APPS_LINEAR_OFFSET
#define APPS_1_UPPER_BOUND
#define APPS_MAX_ERROR_PERCENT
#define BRAKE_BLOCK_THRESHOLD
#define APPS_2_LOWER_BOUND
#define APPS1_DEADZONE_EQUIVALENT
#define APPS_2_UPPER_BOUND
#define APPS_BRAKE_PLAUSIBILITY_TIMEOUT_MS
#define APPS2_DEADZONE_EQUIVALENT
#define APPS2_DEAD_THRESHOLD
#define APPS_IMPLAUSIBLE_TIMEOUT_MS
#define APPS1_DEAD_THRESHOLD
void sendAPPS(int val1, int val2)