[fix] clean screen before draw new graph
This commit is contained in:
		| @@ -8,7 +8,9 @@ | ||||
|  | ||||
| #include "disp_layout.h" | ||||
|  | ||||
| #define abs(x) ((x) < 0 ? -(x) : (x)) | ||||
| #define ABS(x) ((x) < 0 ? -(x) : (x)) | ||||
| #define MAX(x, y) (((x) > (y)) ? (x) : (y)) | ||||
| #define MIN(x, y) (((x) < (y)) ? (x) : (y)) | ||||
|  | ||||
| #define FREQ_MAX_DIGIT 7 | ||||
| #define AMPL_MAX_DIGIT 3 | ||||
| @@ -43,7 +45,7 @@ static void _drawAmplValue(GFX_display_t *disp, uint16_t ampl, uint8_t pos_y) | ||||
| static void _drawOffsValue(GFX_display_t *disp, int16_t offs, uint8_t pos_y) | ||||
| { | ||||
|     uint8_t data[8]; | ||||
|     snprintf((char *)data, 8, "%+01d.%02d V", offs / 100, abs(offs) % 100); | ||||
|     snprintf((char *)data, 8, "%+01d.%02d V", offs / 100, ABS(offs) % 100); | ||||
|     if (offs < 0) | ||||
|     { | ||||
|         data[0] = '-'; | ||||
| @@ -241,18 +243,13 @@ static void _drawValues(GFX_display_t *disp, APP_data_t *app_data) | ||||
|  | ||||
| static void _drawOffsetLine(GFX_display_t *disp, int16_t offs, uint32_t ampl) | ||||
| { | ||||
|     int8_t offs_shift = _calcVerticalShiftInPxl(offs, ampl); | ||||
|     int8_t vert_shift = _calcVerticalShiftInPxl(offs, ampl); | ||||
|  | ||||
|     if (offs_shift > 20) | ||||
|     { | ||||
|         offs_shift = 20; | ||||
|     } | ||||
|     if (offs_shift < -19) | ||||
|     { | ||||
|         offs_shift = -19; | ||||
|     } | ||||
|     vert_shift = MIN(vert_shift, 20); | ||||
|     vert_shift = MAX(vert_shift, -19); | ||||
|  | ||||
|     DISP_drawHorizontalLine(disp, 2, 31 + offs_shift, 57, GFX_WHITE); | ||||
|     ULOG_TRACE("<OFFSLINE> shift: %i", vert_shift); | ||||
|     DISP_drawHorizontalLine(disp, 2, 31 + vert_shift, 57, GFX_WHITE); | ||||
| } | ||||
|  | ||||
| // static void _drawMaxAmpLine(GFX_display_t *disp, int16_t offs, uint32_t ampl) | ||||
| @@ -267,6 +264,7 @@ static void _drawOffsetLine(GFX_display_t *disp, int16_t offs, uint32_t ampl) | ||||
| static void _drawFunGenGraph(GFX_display_t *disp, APP_data_t *app_data) | ||||
| { | ||||
|     GEN_fg_t *fun_gen = (GEN_fg_t *)app_data->generator; | ||||
|     DISP_clearRegion(disp, 3, 12, 57, 40); | ||||
|  | ||||
|     switch (fun_gen->wave) | ||||
|     { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user