Skip to content

Commit 85565ea

Browse files
committed
fix all dash unit mistakes hopefully?
1 parent 6b7466e commit 85565ea

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Telemetry-Main/BT817Q/layouts.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,11 @@ void Layouts::drawStandardLayout2(
207207
drawFormattedText(70, 450, "STEER %03.2f ", 24, OPT_CENTER, steering_angle);
208208

209209
drawRect(Point{614, 127}, Point{637, 310}, mid_gray);
210-
uint16_t throttle_bar_h = (310 - floor(183 * throttle_demand));
210+
uint16_t throttle_bar_h = 127 + 183*throttle_demand;
211211
drawRect(Point{614, throttle_bar_h}, Point{637, 310}, green);
212212

213213
drawRect(Point{643, 127}, Point{666, 310}, mid_gray);
214-
uint16_t brake_bar_h = (310 - floor(183 * brake_demand));
214+
uint16_t brake_bar_h = 127 + 183*brake_demand;
215215
drawRect(Point{643, brake_bar_h}, Point{666, 310}, red);
216216
// drawRect(Point{643, static_cast<uint16_t>(brake_demand)}, Point{666, 310},
217217
// red);

Telemetry-Main/main.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ void update_dash() {
110110
.faults =
111111
Faults{false, static_cast<bool>(vsm_state.accStatus.PRECHARGE_DONE),
112112
static_cast<bool>(!vsm_state.accStatus.SHUTDOWN_STATE)},
113-
.speed = static_cast<uint8_t>(vsm_state.smeThrottleDemand.TORQUE_DEMAND / 327.68),
113+
.speed = static_cast<uint8_t>(vsm_state.smeTrqSpd.SPEED * 112 / 7500),
114114
.soc = vsm_state.accPower.SOC,
115115
.acc_temp = max_temp,
116116
.ctrl_tmp = vsm_state.smeTemp.CONTROLLER_TEMP,
@@ -121,9 +121,9 @@ void update_dash() {
121121
.brake_balance = vsm_state.brake_sensor_f / (vsm_state.brake_sensor_f + vsm_state.brake_sensor_r),
122122
.brake_f = vsm_state.brake_sensor_f,
123123
.brake_r = vsm_state.brake_sensor_r,
124-
// .throttle_demand = static_cast<float>(vsm_state.smeThrottleDemand.TORQUE_DEMAND/32768.0),
125-
.throttle_demand = static_cast<float>(vsm_state.smeTrqSpd.SPEED) * 112/7500.0f,
126-
.brake_demand = static_cast<float>(((vsm_state.etcStatus.BRAKE_SENSE_VOLTAGE / 1000.0) - 0.5) / 4),
124+
.throttle_demand = static_cast<float>(vsm_state.smeThrottleDemand.TORQUE_DEMAND / 32768.0), // 0-1
125+
// 0.33 - 1.65
126+
.brake_demand = static_cast<float>(((vsm_state.etcStatus.BRAKE_SENSE_VOLTAGE / 32768.0)*3.3 - 0.33) / (1.65 - 0.33)),
127127
.time = chrono::milliseconds(0),
128128
.delta_time_seconds = 0.01,
129129
.rtds = static_cast<bool>(vsm_state.etcStatus.RTD),

0 commit comments

Comments
 (0)