Add default-value to Menu, Optimize value-screen, Add Beeping
menu:
- optimize set-value page: send static content only once
so only update value -> significant performance boost
- formatting
- reset control timeout to prevent unintended exit and bugged display
- menu item: add option to show a default value (function ptr)
- add default value to adjust fading
- add beeping
motorctl:
- dont write to nvs when value is unchanged
This commit is contained in:
@@ -351,7 +351,7 @@ void controlledMotor::setFade(fadeType_t fadeType, uint32_t msFadeNew){
|
||||
break;
|
||||
case fadeType_t::DECEL:
|
||||
ESP_LOGW(TAG, "[%s] changed fade-down time from %d to %d",config.name, msFadeDecel, msFadeNew);
|
||||
msFadeDecel = msFadeNew;
|
||||
// write new value to nvs and update the variable
|
||||
writeDecelDuration(msFadeNew);
|
||||
break;
|
||||
}
|
||||
@@ -474,6 +474,11 @@ void controlledMotor::loadDecelDuration(void)
|
||||
// write provided value to nvs to be persistent and update the local variable msFadeAccel
|
||||
void controlledMotor::writeAccelDuration(uint32_t newValue)
|
||||
{
|
||||
// check if unchanged
|
||||
if(msFadeAccel == newValue){
|
||||
ESP_LOGW(TAG, "value unchanged at %d, not writing to nvs", newValue);
|
||||
return;
|
||||
}
|
||||
// generate nvs storage key
|
||||
char key[15];
|
||||
snprintf(key, 15, "m-%s-accel", config.name);
|
||||
@@ -498,6 +503,11 @@ void controlledMotor::writeAccelDuration(uint32_t newValue)
|
||||
// TODO: reduce duplicate code
|
||||
void controlledMotor::writeDecelDuration(uint32_t newValue)
|
||||
{
|
||||
// check if unchanged
|
||||
if(msFadeDecel == newValue){
|
||||
ESP_LOGW(TAG, "value unchanged at %d, not writing to nvs", newValue);
|
||||
return;
|
||||
}
|
||||
// generate nvs storage key
|
||||
char key[15];
|
||||
snprintf(key, 15, "m-%s-decel", config.name);
|
||||
|
||||
Reference in New Issue
Block a user