Skip to content

Commit 20d699a

Browse files
authored
Bugfix Release 2.2.2 (#42)
1 parent 873790d commit 20d699a

File tree

10 files changed

+103
-56
lines changed

10 files changed

+103
-56
lines changed

data/help.htm

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,22 @@ <h4 class="card-title">Brew Bubbles Support</h4>
9393
<div class="card-body">
9494
<p>Brew Bubbles documentation, issue reporting and support can be found at
9595
the following links:<br>
96-
<ul class="fa-ul">
97-
<li><span class="fa-li"><i class="fas fa-home"></i></span>Visit the <a
98-
href="https://www.brewbubbles.com/">Homepage</a></li>
99-
<li><span class="fa-li"><i class="fab fa-github"></i></span>Visit project on <a
100-
href="https://github.com/lbussy/brew-bubbles/">GitHub</a></li>
101-
<li><span class="fa-li"><i class="fas fa-book"></i></span>Read the <a
102-
href="http://docs.brewbubbles.com/">Documentation</a></li>
103-
<li><span class="fa-li"><i class="fas fa-bug"></i></span>Report an <a
104-
href="https://github.com/lbussy/brew-bubbles/issues">issue or bug</a></li>
105-
<li><span class="fa-li"><i class="fas fa-hands-helping"></i></span>Get support or chat with
106-
other users on the <a href="http://support.brewbubbles.com/">HomeBrewTalk Thread</a>
107-
</li>
108-
</ul>
96+
<ul class="fa-ul">
97+
<li><span class="fa-li"><i class="fas fa-home"></i></span>Visit the <a
98+
href="https://www.brewbubbles.com/">Homepage</a></li>
99+
<li><span class="fa-li"><i class="fab fa-github"></i></span>Visit project on <a
100+
href="https://github.com/lbussy/brew-bubbles/">GitHub</a></li>
101+
<li><span class="fa-li"><i class="fas fa-book"></i></span>Read the <a
102+
href="http://docs.brewbubbles.com/">Documentation</a></li>
103+
<li><span class="fa-li"><i class="fas fa-bug"></i></span>Report an <a
104+
href="https://github.com/lbussy/brew-bubbles/issues">issue or bug</a></li>
105+
<li><span class="fa-li"><i class="fas fa-hands-helping"></i></span>Get support or chat with
106+
other users on the <a href="http://support.brewbubbles.com/">HomeBrewTalk Thread</a>
107+
</li>
108+
<li><span class="fa-li"><i class="fas fa-chalkboard-teacher"></i></span>Discuss on
109+
<a href="http://support.brewbubbles.com/">GitHub Discussions</a>
110+
</li>
111+
</ul>
109112
</p>
110113
</div>
111114
</div> <!-- About Brew Bubbles Information -->

json_models/Config JSON.md

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
},
4141
"dospiffs1": false,
4242
"dospiffs2": false,
43-
"didupdate": false
43+
"didupdate": false,
44+
"nodrd": false
4445
}
4546
```
4647

@@ -51,18 +52,24 @@ const size_t capacity = 3*JSON_OBJECT_SIZE(2) + JSON_OBJECT_SIZE(3) + 3*JSON_OBJ
5152
512+728 = 1240
5253
```
5354

54-
## Parsing:
55+
## Deserializing:
5556

5657
```
57-
const size_t capacity = 3*JSON_OBJECT_SIZE(2) + JSON_OBJECT_SIZE(3) + 3*JSON_OBJECT_SIZE(4) + JSON_OBJECT_SIZE(11) + 810;
58-
DynamicJsonDocument doc(capacity);
58+
// char* input;
59+
// size_t inputLength; (optional)
60+
61+
StaticJsonDocument<768> doc;
5962
60-
const char* json = "{\"apconfig\":{\"ssid\":\"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\"passphrase\":\"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"},\"hostname\":\"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\"bubble\":{\"name\":\"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\"tempinf\":false},\"calibrate\":{\"room\":-999.9999,\"vessel\":-999.9999},\"urltarget\":{\"url\":\"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\"freq\":999,\"update\":false},\"brewersfriend\":{\"key\":\"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\"channel\":0,\"freq\":9999,\"update\":false},\"brewfather\":{\"key\":\"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\"channel\":0,\"freq\":9999,\"update\":false},\"thingspeak\":{\"key\":\"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\"channel\":999999999,\"freq\":9999,\"update\":false},\"dospiffs1\":false,\"dospiffs2\":false,\"didupdate\":false}";
63+
DeserializationError error = deserializeJson(doc, input, inputLength);
6164
62-
deserializeJson(doc, json);
65+
if (error) {
66+
Serial.print(F("deserializeJson() failed: "));
67+
Serial.println(error.f_str());
68+
return;
69+
}
6370
6471
const char* apconfig_ssid = doc["apconfig"]["ssid"]; // "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
65-
const char* apconfig_passphrase = doc["apconfig"]["passphrase"]; // "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
72+
const char* apconfig_passphrase = doc["apconfig"]["passphrase"];
6673
6774
const char* hostname = doc["hostname"]; // "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
6875
@@ -73,38 +80,38 @@ float calibrate_room = doc["calibrate"]["room"]; // -999.9999
7380
float calibrate_vessel = doc["calibrate"]["vessel"]; // -999.9999
7481
7582
JsonObject urltarget = doc["urltarget"];
76-
const char* urltarget_url = urltarget["url"]; // "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
83+
const char* urltarget_url = urltarget["url"];
7784
int urltarget_freq = urltarget["freq"]; // 999
7885
bool urltarget_update = urltarget["update"]; // false
7986
8087
JsonObject brewersfriend = doc["brewersfriend"];
81-
const char* brewersfriend_key = brewersfriend["key"]; // "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
88+
const char* brewersfriend_key = brewersfriend["key"];
8289
int brewersfriend_channel = brewersfriend["channel"]; // 0
8390
int brewersfriend_freq = brewersfriend["freq"]; // 9999
8491
bool brewersfriend_update = brewersfriend["update"]; // false
8592
8693
JsonObject brewfather = doc["brewfather"];
87-
const char* brewfather_key = brewfather["key"]; // "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
94+
const char* brewfather_key = brewfather["key"];
8895
int brewfather_channel = brewfather["channel"]; // 0
8996
int brewfather_freq = brewfather["freq"]; // 9999
9097
bool brewfather_update = brewfather["update"]; // false
9198
9299
JsonObject thingspeak = doc["thingspeak"];
93-
const char* thingspeak_key = thingspeak["key"]; // "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
100+
const char* thingspeak_key = thingspeak["key"];
94101
long thingspeak_channel = thingspeak["channel"]; // 999999999
95102
int thingspeak_freq = thingspeak["freq"]; // 9999
96103
bool thingspeak_update = thingspeak["update"]; // false
97104
98105
bool dospiffs1 = doc["dospiffs1"]; // false
99106
bool dospiffs2 = doc["dospiffs2"]; // false
100107
bool didupdate = doc["didupdate"]; // false
108+
bool nodrd = doc["nodrd"]; // false
101109
```
102110

103111
## Serializing:
104112

105113
```
106-
const size_t capacity = 3*JSON_OBJECT_SIZE(2) + JSON_OBJECT_SIZE(3) + 3*JSON_OBJECT_SIZE(4) + JSON_OBJECT_SIZE(11);
107-
DynamicJsonDocument doc(capacity);
114+
DynamicJsonDocument doc(1536);
108115
109116
JsonObject apconfig = doc.createNestedObject("apconfig");
110117
apconfig["ssid"] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
@@ -144,6 +151,7 @@ thingspeak["update"] = false;
144151
doc["dospiffs1"] = false;
145152
doc["dospiffs2"] = false;
146153
doc["didupdate"] = false;
154+
doc["nodrd"] = false;
147155
148-
serializeJson(doc, Serial);
156+
serializeJson(doc, output);
149157
```

platformio.ini

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,34 +16,39 @@ platform = espressif8266
1616
build_unflags =
1717
build_flags =
1818
!python tools\git_rev.py
19-
-D PIO_SRC_TAG=2.2.1
19+
-D PIO_SRC_TAG=2.2.2
2020
-D BAUD=${common_env_data.monitor_speed}
21-
; -DDEBUG_ESP_PORT=Serial
22-
; -DDEBUG_ESP_WIFI
23-
; -DDEBUG_ESP_HTTP_UPDATE
24-
; -DDEBUG_ESP_CORE
25-
; -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY ; v2 Lower Memory (default)
26-
; -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH ; v2 Higher Bandwidth
27-
; -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY_LOW_FLASH ; v2 Lower Memory (no features)
28-
; -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH ; v2 Higher Bandwidth (no features)
29-
; -DPIO_FRAMEWORK_ARDUINO_LWIP2_IPV6_LOW_MEMORY ; v2 IPv6 Lower Memory
30-
; -DPIO_FRAMEWORK_ARDUINO_LWIP2_IPV6_HIGHER_BANDWIDTH ; v2 IPv6 Higher Bandwidth
31-
; -DPIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH ; v1.4 Higher Bandwidth
21+
-DDEBUG_ESP_PORT=Serial
22+
; -D DEBUG_ESP_WIFI
23+
; -D DEBUG_ESP_HTTP_UPDATE
24+
; -D DEBUG_ESP_HTTP_CLIENT
25+
; -D DEBUG_ESP_UPDATE
26+
; -D DEBUG_ESP_OTA
27+
; -D DEBUG_ESP_OOM
28+
; -include "umm_malloc/umm_malloc_cfg.h"
29+
; -D DEBUG_ESP_CORE
30+
; -D PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY ; v2 Lower Memory (default)
31+
; -D PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH ; v2 Higher Bandwidth
32+
; -D PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY_LOW_FLASH ; v2 Lower Memory (no features)
33+
; -D PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH ; v2 Higher Bandwidth (no features)
34+
; -D PIO_FRAMEWORK_ARDUINO_LWIP2_IPV6_LOW_MEMORY ; v2 IPv6 Lower Memory
35+
; -D PIO_FRAMEWORK_ARDUINO_LWIP2_IPV6_HIGHER_BANDWIDTH ; v2 IPv6 Higher Bandwidth
36+
-D PIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH ; v1.4 Higher Bandwidth
3237
extra_scripts = ; pre:python tools\name_firmware.py
3338
lib_deps =
3439
ArduinoJson
3540
https://github.com/lbussy/OneWire.git
3641
https://github.com/lbussy/DS18B20.git
3742
https://github.com/lbussy/Arduino-Log.git
38-
https://github.com/lbussy/ESPAsyncWebServer.git#littlefs
43+
https://github.com/lbussy/ESPAsyncWebServer.git
3944
https://github.com/lbussy/AsyncWiFiManager.git
4045
https://github.com/lbussy/ESPAsyncTCP
4146
https://github.com/lbussy/asyncHTTPrequest.git
4247
https://github.com/lbussy/CircularBuffer.git
4348
https://github.com/lbussy/LCBUrl.git
4449
https://github.com/lbussy/esptelnet.git
45-
ESP_DoubleResetDetector
46-
ThingSpeak
50+
https://github.com/lbussy/ESP_DoubleResetDetector
51+
https://github.com/lbussy/ThingSpeak
4752
monitor_filters =
4853
esp8266_exception_decoder
4954
; log2file

src/execota.cpp

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ void execfw()
3838
ESPhttpUpdate.setLedPin(LED, LOW);
3939
// "http://www.brewbubbles.com/firmware/firmware.bin"
4040
WiFiClient _client;
41+
Log.verbose(F("Pulling Firmware from: %s" CR), F(FIRMWAREURL));
42+
config.nodrd = true;
43+
saveConfig();
4144
t_httpUpdate_return ret = ESPhttpUpdate.update(_client, F(FIRMWAREURL), "0");
4245

4346
switch (ret)
@@ -48,7 +51,9 @@ void execfw()
4851
config.dospiffs1 = false;
4952
config.dospiffs2 = false;
5053
config.didupdate = false;
54+
config.nodrd = true;
5155
saveConfig();
56+
_delay(100);
5257
ESP.restart();
5358
break;
5459

@@ -58,16 +63,20 @@ void execfw()
5863
config.dospiffs1 = false;
5964
config.dospiffs2 = false;
6065
config.didupdate = false;
66+
config.nodrd = true;
6167
saveConfig();
68+
_delay(100);
6269
ESP.restart();
6370
break;
6471

6572
case HTTP_UPDATE_OK:
6673
// We should never actually reach this as the controller
6774
// resets after OTA
6875
Log.notice(F("HTTP Firmware OTA Update complete, restarting." CR));
76+
config.nodrd = true;
77+
saveConfig();
78+
_delay(100);
6979
ESP.restart();
70-
_delay(1000);
7180
break;
7281
}
7382
}
@@ -80,13 +89,10 @@ void execspiffs()
8089
config.dospiffs1 = false;
8190
config.dospiffs2 = true;
8291
config.didupdate = false;
92+
config.nodrd = true;
8393
saveConfig();
84-
_delay(3000);
85-
if (LittleFS.begin())
86-
if (LittleFS.remove("/drd.dat"))
87-
Log.notice(F("Deleted DRD semaphore." CR));
94+
_delay(100);
8895
ESP.restart();
89-
_delay(1000);
9096
}
9197
else if (config.dospiffs2)
9298
{
@@ -98,6 +104,7 @@ void execspiffs()
98104
ESPhttpUpdate.setLedPin(LED, LOW);
99105
// "http://www.brewbubbles.com/firmware/spiffs.bin"
100106
WiFiClient client;
107+
Log.verbose(F("Pulling Filesystem from: %s" CR), F(LITTLEFSURL));
101108
t_httpUpdate_return ret = ESPhttpUpdate.updateFS(client, F(LITTLEFSURL), "");
102109

103110
switch (ret)
@@ -115,11 +122,11 @@ void execspiffs()
115122
config.dospiffs1 = false;
116123
config.dospiffs2 = false;
117124
config.didupdate = true;
118-
saveConfig(); // This not only saves the flags, it (re)saves the whole config after File System wipes it
119-
_delay(1000);
125+
config.nodrd = true;
120126
Log.notice(F("HTTP File System OTA Update complete, restarting." CR));
127+
saveConfig(); // This not only saves the flags, it (re)saves the whole config after File System wipes it
128+
_delay(100);
121129
ESP.restart();
122-
_delay(1000);
123130
break;
124131
}
125132
}

src/jsonconfig.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ SOFTWARE. */
2525
const char *filename = "/config.json";
2626
Config config;
2727

28-
extern const size_t capacitySerial = 3 * JSON_OBJECT_SIZE(2) + JSON_OBJECT_SIZE(3) + 3 * JSON_OBJECT_SIZE(4) + JSON_OBJECT_SIZE(11);
29-
extern const size_t capacityDeserial = capacitySerial + 810;
28+
extern const size_t capacitySerial = 1536;
29+
extern const size_t capacityDeserial = 768;
3030

3131
bool deleteConfigFile()
3232
{
@@ -478,6 +478,15 @@ void Config::load(JsonObjectConst obj)
478478
{
479479
didupdate = obj["didupdate"];
480480
}
481+
482+
if (obj["nodrd"].isNull())
483+
{
484+
nodrd = false;
485+
}
486+
else
487+
{
488+
nodrd = obj["nodrd"];
489+
}
481490
}
482491

483492
void Config::save(JsonObject obj) const
@@ -504,4 +513,6 @@ void Config::save(JsonObject obj) const
504513
obj["dospiffs2"] = dospiffs2;
505514
// Add dospiffs1 object
506515
obj["didupdate"] = didupdate;
516+
// Add nodrd object
517+
obj["nodrd"] = nodrd;
507518
}

src/jsonconfig.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ struct Config
9494
bool dospiffs1;
9595
bool dospiffs2;
9696
bool didupdate;
97+
bool nodrd;
9798

9899
void load(JsonObjectConst);
99100
void save(JsonObject) const;

src/main.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,15 @@ void setup()
4444
Log.notice(F("%s low, presenting portal." CR), stringify(RESETWIFI));
4545
doWiFi(true);
4646
}
47-
else if (drd->detectDoubleReset())
47+
else if (!config.nodrd && drd->detectDoubleReset())
4848
{
4949
Log.notice(F("DRD: Triggered, presenting portal." CR));
5050
doWiFi(true);
5151
}
5252
else
5353
{
5454
Log.verbose(F("DRD: Normal boot." CR));
55+
config.nodrd = false;
5556
doWiFi();
5657
}
5758

src/thingSpeakWork.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ int createChannel(
196196
channelJSON = http.getString();
197197

198198
#ifdef PRINT_DEBUG_MESSAGES
199-
Serial.println(F("DEBUG: Create ThingSpeak Channel results:"));
199+
Serial.println(F("Create ThingSpeak Channel results:"));
200200
Serial.println(httpCode); //Print HTTP return code
201201
Serial.println(channelJSON); //Print request response payload
202202
#endif

src/tools.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ void resetController()
4242
Log.notice(F("Reboot request - rebooting system." CR));
4343
_delay(5000);
4444
saveBpm();
45+
config.nodrd = true;
46+
saveConfig();
47+
_delay(100);
4548
ESP.restart();
4649
}
4750

@@ -137,6 +140,9 @@ void maintenanceLoop()
137140
// The ms clock will rollover after ~49 days. To be on the safe side,
138141
// restart the ESP after about 42 days to reset the ms clock.
139142
Log.warning(F("Maintenance: Six week routine restart."));
143+
config.nodrd = true;
144+
saveConfig();
145+
_delay(100);
140146
ESP.restart();
141147
}
142148
if (lastNTPUpdate > NTPRESET)

src/wifihandler.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,10 @@ void doWiFi(bool dontUseStoredCreds)
125125
_delay(3000);
126126
digitalWrite(LED, HIGH);
127127
Log.warning(F("Restarting." CR));
128+
config.nodrd = true;
129+
saveConfig();
130+
_delay(100);
128131
ESP.restart();
129-
_delay(1000); // Just a hack to give it time to reset
130132
}
131133
else
132134
{
@@ -178,6 +180,9 @@ void resetWifi()
178180
blinker.detach(); // Turn off blinker
179181
digitalWrite(LED, LOW); // Turn on LED
180182
Log.notice(F("Restarting after clearing WiFi settings." CR));
183+
config.nodrd = true;
184+
saveConfig();
185+
_delay(100);
181186
ESP.restart();
182187
}
183188

0 commit comments

Comments
 (0)