fix(color): throttle graph on the statistics page may display incorrectly (#7447)
This commit is contained in:
@@ -106,17 +106,20 @@ class ThrottleCurveWindow : public Window
|
|||||||
void checkEvents() override
|
void checkEvents() override
|
||||||
{
|
{
|
||||||
Window::checkEvents();
|
Window::checkEvents();
|
||||||
if (previousTraceWr != s_traceWr) {
|
// Copy current value as mixer may update it
|
||||||
previousTraceWr = s_traceWr;
|
uint16_t traceWr = s_traceWr;
|
||||||
|
if (previousTraceWr != traceWr) {
|
||||||
|
previousTraceWr = traceWr;
|
||||||
|
|
||||||
graphSize = 0;
|
graphSize = 0;
|
||||||
uint16_t traceRd = s_traceWr > width() ? s_traceWr - width() : 0;
|
uint16_t traceRd = traceWr > width() ? traceWr % width() : 0;
|
||||||
for (lv_coord_t x = 0; x < width() && traceRd < s_traceWr;
|
for (lv_coord_t x = 0; x < width() && traceRd < traceWr; x += 1) {
|
||||||
x += 1, traceRd += 1) {
|
uint8_t h = s_traceBuf[traceRd];
|
||||||
uint8_t h = s_traceBuf[traceRd % width()];
|
|
||||||
lv_coord_t y = height() - PAD_THREE - CV_SCALE * h;
|
lv_coord_t y = height() - PAD_THREE - CV_SCALE * h;
|
||||||
graph[x] = {x, y};
|
graph[x] = {x, y};
|
||||||
graphSize += 1;
|
graphSize += 1;
|
||||||
|
traceRd += 1;
|
||||||
|
if (traceRd >= width()) traceRd = 0;
|
||||||
}
|
}
|
||||||
lv_line_set_points(line, graph, graphSize);
|
lv_line_set_points(line, graph, graphSize);
|
||||||
}
|
}
|
||||||
@@ -126,7 +129,7 @@ class ThrottleCurveWindow : public Window
|
|||||||
unsigned previousTraceWr = 0;
|
unsigned previousTraceWr = 0;
|
||||||
lv_point_t graph[MAXTRACE];
|
lv_point_t graph[MAXTRACE];
|
||||||
lv_point_t axis[3];
|
lv_point_t axis[3];
|
||||||
lv_point_t ticks[MAXTRACE * 2 / 6];
|
lv_point_t ticks[((MAXTRACE + 3) / 6) * 2];
|
||||||
lv_obj_t* line = nullptr;
|
lv_obj_t* line = nullptr;
|
||||||
int16_t graphSize = 0;
|
int16_t graphSize = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user