Skip to content

Commit

Permalink
SSD1306 prefs start-up optimisation
Browse files Browse the repository at this point in the history
Avoid
[ 137][E][Preferences.cpp:483] getString(): nvs_get_str len fail: SSD1306Config NOT_FOUND
error during start-up when no save preferences have been found
  • Loading branch information
DigiH committed Mar 27, 2023
1 parent 0ece563 commit 2702c8f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main/ZdisplaySSD1306.ino
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ void SSD1306Config_init() {
bool SSD1306Config_load() {
StaticJsonDocument<JSON_MSG_BUFFER> jsonBuffer;
preferences.begin(Gateway_Short_Name, true);
String exists = preferences.getString("SSD1306Config", "{}");
if (exists != "{}") {
bool exists = preferences.isKey("SSD1306Config");
if (exists) {
auto error = deserializeJson(jsonBuffer, preferences.getString("SSD1306Config", "{}"));
preferences.end();
if (error) {
Expand Down

0 comments on commit 2702c8f

Please sign in to comment.