No autoattenuation in normalized mode and markers turn red on overload

pull/4/head
erikkaashoek 6 years ago
parent 235840e9a9
commit 95fda046ef

@ -1899,6 +1899,9 @@ cell_draw_marker_info(int x0, int y0)
} }
} }
#endif #endif
extern float temppeakLevel;
static void cell_draw_marker_info(int x0, int y0) static void cell_draw_marker_info(int x0, int y0)
{ {
char buf[32]; char buf[32];
@ -1988,7 +1991,13 @@ static void cell_draw_marker_info(int x0, int y0)
buf[k++] = ' '; buf[k++] = ' ';
// buf[k++] = 0; // buf[k++] = 0;
ili9341_set_background(DEFAULT_BG_COLOR); ili9341_set_background(DEFAULT_BG_COLOR);
ili9341_set_foreground(marker_color(markers[i].mtype)); uint16_t color;
if ((setting.mode == M_LOW && temppeakLevel - get_attenuation() > -1) ||
(setting.mode == M_HIGH && temppeakLevel - get_attenuation() > -10))
color = BRIGHT_COLOR_RED;
else
color = marker_color(markers[i].mtype);
ili9341_set_foreground(color);
// if (setting.unit) // if (setting.unit)
// cell_drawstring(buf, xpos, ypos); // cell_drawstring(buf, xpos, ypos);
// else // else

@ -417,6 +417,7 @@ void set_subtract_storage(void)
if (!setting.show_stored) if (!setting.show_stored)
set_storage(); set_storage();
setting.subtract_stored = true; setting.subtract_stored = true;
// setting.auto_attenuation = false;
} else { } else {
setting.subtract_stored = false; setting.subtract_stored = false;
} }
@ -430,6 +431,7 @@ void toggle_normalize(void)
for (int i=0; i<POINTS_COUNT;i++) for (int i=0; i<POINTS_COUNT;i++)
stored_t[i] = actual_t[i]; stored_t[i] = actual_t[i];
setting.subtract_stored = true; setting.subtract_stored = true;
setting.auto_attenuation = false; // Otherwise noise level may move leading to strange measurements
} else { } else {
setting.subtract_stored = false; setting.subtract_stored = false;
} }
@ -1630,7 +1632,7 @@ again:
redraw_request |= REDRAW_CAL_STATUS; redraw_request |= REDRAW_CAL_STATUS;
} }
if (!in_selftest && setting.mode == M_LOW && setting.auto_attenuation && max_index[0] > 0 && !setting.subtract_stored) { // Auto attenuate if (!in_selftest && setting.mode == M_LOW && setting.auto_attenuation && max_index[0] > 0) { // Auto attenuate
setting.atten_step = false; // No step attenuate in low mode auto attenuate setting.atten_step = false; // No step attenuate in low mode auto attenuate
float old_attenuate = get_attenuation(); float old_attenuate = get_attenuation();
float actual_max_level = actual_t[max_index[0]] - old_attenuate; float actual_max_level = actual_t[max_index[0]] - old_attenuate;

Loading…
Cancel
Save

Powered by TurnKey Linux.