Reduce variables stored to flash

This commit is contained in:
Edward Firmo
2024-01-22 22:14:52 +01:00
parent 98c6cf9849
commit bccb7c86af
2 changed files with 103 additions and 75 deletions

View File

@@ -90,20 +90,20 @@ globals:
restore_value: false
initial_value: ${upload_tft_baud_rate}
- id: tft_branch
type: uint
restore_value: true
initial_value: '0'
#- id: tft_branch
# type: uint
# restore_value: true
# initial_value: '0'
- id: tft_is_valid
type: bool
restore_value: false
initial_value: 'false'
- id: tft_model
type: uint
restore_value: true
initial_value: '0'
#- id: tft_model
# type: uint
# restore_value: true
# initial_value: '0'
- id: tft_upload_attempt
type: uint
@@ -216,15 +216,15 @@ script:
- lambda: |-
static const char *const TAG = "addon_upload_tft.script.restore_settings";
ESP_LOGD(TAG, "Restoring TFT file branch selector to index %u", id(tft_branch));
auto tft_file_branch_call = id(tft_file_branch).make_call();
tft_file_branch_call.set_index(id(tft_branch));
tft_file_branch_call.perform();
// ESP_LOGD(TAG, "Restoring TFT file branch selector to index %u", id(tft_branch));
// auto tft_file_branch_call = id(tft_file_branch).make_call();
// tft_file_branch_call.set_index(id(tft_branch));
// tft_file_branch_call.perform();
ESP_LOGD(TAG, "Restoring TFT file model selector to index %u", id(tft_model));
auto tft_file_model_call = id(tft_file_model).make_call();
tft_file_model_call.set_index(id(tft_model));
tft_file_model_call.perform();
// ESP_LOGD(TAG, "Restoring TFT file model selector to index %u", id(tft_model));
// auto tft_file_model_call = id(tft_file_model).make_call();
// tft_file_model_call.set_index(id(tft_model));
// tft_file_model_call.perform();
- id: set_tft_file
mode: restart
@@ -241,10 +241,10 @@ script:
ESP_LOGD(TAG, "TFT URL set:");
ESP_LOGD(TAG, " Branch: %s", branch.c_str());
ESP_LOGD(TAG, " Model: %s", model.c_str());
if (id(is_restored_settings) and tft_file_branch->active_index().has_value())
id(tft_branch) = tft_file_branch->active_index().value();
if (id(is_restored_settings) and tft_file_model->active_index().has_value())
id(tft_model) = tft_file_model->active_index().value();
// if (id(is_restored_settings) and tft_file_branch->active_index().has_value())
// id(tft_branch) = tft_file_branch->active_index().value();
// if (id(is_restored_settings) and tft_file_model->active_index().has_value())
// id(tft_model) = tft_file_model->active_index().value();
if (id(is_uploading_tft))
ESP_LOGW(TAG, " TFT Upload in progress.");
@@ -1227,7 +1227,7 @@ select:
- "dev"
initial_option: "v${version}"
optimistic: true
restore_value: true
restore_value: false
internal: true
entity_category: config
disabled_by_default: true