[fix] clean screen before draw new graph

This commit is contained in:
2023-05-01 15:12:54 +02:00
parent f729829cb2
commit f0f71f3252
2 changed files with 25 additions and 22 deletions

View File

@@ -136,8 +136,11 @@ static void _changeValueFunGen(int8_t dir)
}
default:
ULOG_ERROR("%s:%d: Unknown layout: %d", __FILE__, __LINE__, _app_data->curr_state_lay);
break;
return;
}
_app_data->isValueChange = 1;
_app_data->isGraphChange = 1;
}
static void _changeValuePwmGen(int8_t dir)
@@ -149,7 +152,7 @@ static void _changeValuePwmGen(int8_t dir)
case LAY_FREQ:
{
uint32_t new_freq = dir * pow_of_10[_app_data->freq_focus_digit] + gen->frequency;
ULOG_DEBUG("<FG> New freq: %lu", new_freq);
ULOG_DEBUG("<PWM> New freq: %lu", new_freq);
if (new_freq > MAX_FREQ)
{
return;
@@ -160,7 +163,7 @@ static void _changeValuePwmGen(int8_t dir)
case LAY_AMPL:
{
uint16_t new_ampl = dir * pow_of_10[_app_data->ampl_focus_digit] + gen->amplitude;
ULOG_DEBUG("<FG> New ampl: %u", new_ampl);
ULOG_DEBUG("<PWM> New ampl: %u", new_ampl);
if (gen->offset + new_ampl > MAX_VOLT_POS || gen->offset - new_ampl < MAX_VOLT_NEG)
{
return;
@@ -171,7 +174,7 @@ static void _changeValuePwmGen(int8_t dir)
case LAY_OFFS:
{
int16_t new_offs = dir * pow_of_10[_app_data->offs_focus_digit] + gen->offset;
ULOG_DEBUG("<FG> New offs: %i", new_offs);
ULOG_DEBUG("<PWM> New offs: %i", new_offs);
if (new_offs + gen->amplitude > MAX_VOLT_POS || new_offs - gen->amplitude < MAX_VOLT_NEG)
{
return;
@@ -182,7 +185,7 @@ static void _changeValuePwmGen(int8_t dir)
case LAY_PHAS:
{
uint16_t new_phas = dir * pow_of_10[_app_data->phas_focus_digit] + gen->phase;
ULOG_DEBUG("<FG> New phas: %u", new_phas);
ULOG_DEBUG("<PWM> New phas: %u", new_phas);
if (new_phas > MAX_PHAS)
{
return;
@@ -193,7 +196,7 @@ static void _changeValuePwmGen(int8_t dir)
case LAY_DUTY:
{
uint8_t new_duty = dir * pow_of_10[_app_data->duty_focus_digit] + gen->duty;
ULOG_DEBUG("<FG> New duty: %u", new_duty);
ULOG_DEBUG("<PWM> New duty: %u", new_duty);
if (new_duty > MAX_DUTY)
{
return;
@@ -202,8 +205,12 @@ static void _changeValuePwmGen(int8_t dir)
break;
}
default:
break;
ULOG_ERROR("%s:%d: Unknown layout: %d", __FILE__, __LINE__, _app_data->curr_state_lay);
return;
}
_app_data->isValueChange = 1;
_app_data->isGraphChange = 1;
}
void CTRL_encoderEvent(int8_t enc)
@@ -219,11 +226,9 @@ void CTRL_encoderEvent(int8_t enc)
break;
default:
ULOG_ERROR("%s:%d: Unknown generator type.", __FILE__, __LINE__);
ULOG_ERROR("%s:%d: Unknown generator type: %d", __FILE__, __LINE__, _app_data->curr_gen_type);
break;
}
_app_data->isValueChange = 1;
}
inline BITMAP_buttonName_t CTRL_getBitmapName(LAY_dispBtn_t disp_btn)