WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit c52bf94

Browse files
authored
Merge pull request #25 from mp-se/dev
Update to 0.7.1
2 parents 5f36072 + 33bfe59 commit c52bf94

File tree

14 files changed

+285
-56
lines changed

14 files changed

+285
-56
lines changed

bin/firmware.bin

1.59 KB
Binary file not shown.

bin/firmware32s2.bin

9.45 KB
Binary file not shown.

part32_coredump.csv

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Name,Type,SubType,Offset,Size,Flags
2+
nvs,data,nvs,0x9000,0x5000
3+
otadata,data,ota,0xe000,0x2000
4+
app0,app,ota_0,0x10000,0x1c0000
5+
app1,app,ota_1,0x1d0000,0x1c0000
6+
spiffs,data,spiffs,0x390000,0x60000
7+
coredump,data,coredump,0x3F0000,0x10000

platformio.ini

Lines changed: 50 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ include_dir = lib
1515
[common_env_data]
1616
upload_speed = 921600
1717
monitor_speed = 115200
18-
platform = espressif8266 @ 4.1.0
19-
platform32 = espressif32 @ 5.3.0
18+
platform = espressif8266 @ 4.2.0
19+
platform32 = espressif32 @ 6.3.2
2020
framework = arduino
2121
build_unflags =
2222
build_flags =
2323
-D BAUD=${common_env_data.monitor_speed}
2424
-D USER_SSID=\""\"" # =\""myssid\""
2525
-D USER_SSID_PWD=\""\"" # =\""mypwd\""
2626
-D USE_LITTLEFS=true
27-
-D CFG_APPVER="\"0.7.0\""
27+
-D CFG_APPVER="\"0.7.1\""
2828
#-D PERF_ENABLE
2929
-D PERF_INFLUX_TARGET=\""\""
3030
-D PERF_INFLUX_BUCKET=\""\""
@@ -35,7 +35,7 @@ build_flags =
3535
-D PUSH_INFLUX_BUCKET=\""\""
3636
-D PUSH_INFLUX_ORG=\""\""
3737
-D PUSH_INFLUX_TOKEN=\""\""
38-
#-D CFG_GITREV=\""beta1\""
38+
#-D CFG_GITREV=\""alfa3\""
3939
!python script/git_rev.py
4040
lib_deps =
4141
https://github.com/mp-se/SimpleKalmanFilter#v0.2
@@ -51,6 +51,7 @@ lib_deps =
5151
https://github.com/mp-se/tinyexpr#v1.0.0
5252
https://github.com/mp-se/NAU7802_Arduino_Library#v1.0.4
5353
https://github.com/mp-se/LiquidCrystal_I2C#1.0.0
54+
https://github.com/mp-se/espframework#0.6.3
5455

5556
[env:kegmon-debug]
5657
upload_speed = ${common_env_data.upload_speed}
@@ -67,10 +68,9 @@ build_flags =
6768
#-DDEBUG_ESP_WIFI
6869
#-DDEBUG_ESP_SSL
6970
#-DDEBUG_ESP_CORE
70-
${common_env_data.build_flags}
71+
${common_env_data.build_flags}
7172
-D LOG_LEVEL=6
7273
lib_deps =
73-
https://github.com/mp-se/espframework#0.6.1
7474
${common_env_data.lib_deps}
7575
board = d1_mini
7676
build_type = release
@@ -86,11 +86,10 @@ extra_scripts =
8686
script/copy_firmware.py
8787
build_unflags = ${common_env_data.build_unflags}
8888
build_flags =
89-
${common_env_data.build_flags}
89+
${common_env_data.build_flags}
9090
-D LOG_LEVEL=5
9191
-D USE_ASYNC_WEB
9292
lib_deps =
93-
https://github.com/mp-se/espframework#0.6.1
9493
https://github.com/mp-se/ESPAsyncWebServer
9594
https://github.com/mp-se/ESPAsyncTCP
9695
${common_env_data.lib_deps}
@@ -106,10 +105,9 @@ framework = ${common_env_data.framework}
106105
platform = ${common_env_data.platform}
107106
build_unflags = ${common_env_data.build_unflags}
108107
build_flags =
109-
${common_env_data.build_flags}
108+
${common_env_data.build_flags}
110109
-D LOG_LEVEL=5
111110
lib_deps =
112-
https://github.com/mp-se/espframework#0.6.0
113111
${common_env_data.lib_deps}
114112
board = d1_mini
115113
build_type = release
@@ -123,10 +121,9 @@ framework = ${common_env_data.framework}
123121
platform = ${common_env_data.platform}
124122
build_unflags = ${common_env_data.build_unflags}
125123
build_flags =
126-
${common_env_data.build_flags}
124+
${common_env_data.build_flags}
127125
-D LOG_LEVEL=6
128126
lib_deps =
129-
https://github.com/mp-se/espframework#0.6.0
130127
${common_env_data.lib_deps}
131128
board = d1_mini
132129
build_type = release
@@ -140,10 +137,9 @@ framework = ${common_env_data.framework}
140137
platform = ${common_env_data.platform}
141138
build_unflags = ${common_env_data.build_unflags}
142139
build_flags =
143-
${common_env_data.build_flags}
140+
${common_env_data.build_flags}
144141
-D LOG_LEVEL=6
145142
lib_deps =
146-
https://github.com/mp-se/espframework#0.6.0
147143
https://github.com/bxparks/AUnit#v1.6.1
148144
${common_env_data.lib_deps}
149145
board = d1_mini
@@ -161,20 +157,56 @@ build_unflags = ${common_env_data.build_unflags}
161157
extra_scripts =
162158
script/copy_firmware.py
163159
build_flags =
164-
-D ESP32S2
160+
-D ESP32S2
165161
-D ARDUINO_ESP32S2_DEV
166162
#-D USE_SERIAL_PINS
167163
-D LOG_LEVEL=5
168164
-D USE_ASYNC_WEB
169-
#-D CORE_DEBUG_LEVEL=2
170-
${common_env_data.build_flags}
165+
#-D CORE_DEBUG_LEVEL=5
166+
${common_env_data.build_flags}
171167
lib_deps =
172-
https://github.com/mp-se/espframework#0.6.0
173168
https://github.com/mp-se/ESPAsyncWebServer
174169
https://github.com/mp-se/AsyncTCP
175170
${common_env_data.lib_deps}
176171
build_type = release
177172
board_build.partitions = part32.csv
173+
#board_build.partitions = part32_coredump.csv
174+
board_build.embed_txtfiles =
175+
html/upload.min.htm
176+
html/config.min.htm
177+
html/about.min.htm
178+
html/index.min.htm
179+
html/beer.min.htm
180+
html/calibration.min.htm
181+
html/graph.min.htm
182+
html/stability.min.htm
183+
html/backup.min.htm
184+
html/ws.min.htm
185+
html/dashboard.min.htm
186+
187+
[env:kegmon32s2-debug]
188+
platform = ${common_env_data.platform32}
189+
framework = arduino
190+
board = esp32-s2-kaluga-1
191+
upload_speed = ${common_env_data.upload_speed}
192+
monitor_speed = ${common_env_data.monitor_speed}
193+
build_unflags = ${common_env_data.build_unflags}
194+
extra_scripts =
195+
debug_tool = esp-prog
196+
build_flags =
197+
-D ESP32S2
198+
-D ARDUINO_ESP32S2_DEV
199+
#-D USE_SERIAL_PINS
200+
-D LOG_LEVEL=5
201+
-D USE_ASYNC_WEB
202+
#-D CORE_DEBUG_LEVEL=5
203+
${common_env_data.build_flags}
204+
lib_deps =
205+
https://github.com/mp-se/ESPAsyncWebServer
206+
https://github.com/mp-se/AsyncTCP
207+
${common_env_data.lib_deps}
208+
build_type = debug
209+
board_build.partitions = part32_coredump.csv
178210
board_build.embed_txtfiles =
179211
html/upload.min.htm
180212
html/config.min.htm

src/displayout.cpp

Lines changed: 64 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@ void DisplayLayout::showGraph(UnitIndex idx, bool isScaleConnected,
175175
}
176176

177177
void DisplayLayout::showGraphOne(UnitIndex idx, bool isScaleConnected,
178-
float beerVolume) {
178+
float beerVolume, float pour,
179+
float beerWeight) {
180+
// Handle printout to display #1 which will show all the graphs
179181
if (idx == UnitIndex::U1) {
180182
myDisplay.clear(UnitIndex::U1);
181183
myDisplay.setFont(UnitIndex::U1, FontSize::FONT_16);
@@ -208,9 +210,62 @@ void DisplayLayout::showGraphOne(UnitIndex idx, bool isScaleConnected,
208210
myDisplay.getFontHeight(UnitIndex::U1) * 3,
209211
"No scale");
210212
}
211-
212213
myDisplay.show(UnitIndex::U1);
213214
}
215+
216+
// Handle printout to display #2 which will show all the details (iterating
217+
// between the two displays)
218+
if (isScaleConnected) {
219+
myDisplay.setFont(UnitIndex::U2, FontSize::FONT_16);
220+
221+
switch (_iter) {
222+
case DisplayIterator::ShowTemp:
223+
case DisplayIterator::ShowWeight:
224+
if (idx == UnitIndex::U1) {
225+
myDisplay.clear(UnitIndex::U2);
226+
227+
myDisplay.printPosition(UnitIndex::U2, -1,
228+
myDisplay.getFontHeight(UnitIndex::U2) * 0,
229+
getFormattedBeerName(idx));
230+
myDisplay.printPosition(UnitIndex::U2, -1,
231+
myDisplay.getFontHeight(UnitIndex::U2) * 1,
232+
getFormattedPour(pour));
233+
myDisplay.printPosition(UnitIndex::U2, -1,
234+
myDisplay.getFontHeight(idx) * 2,
235+
getFormattedBeerWeight(beerWeight));
236+
237+
myDisplay.setFont(UnitIndex::U2, FontSize::FONT_10);
238+
myDisplay.printPosition(UnitIndex::U2, -1,
239+
myDisplay.getDisplayHeight(UnitIndex::U2) -
240+
myDisplay.getFontHeight(UnitIndex::U2),
241+
getFormattedWifiName());
242+
}
243+
break;
244+
case DisplayIterator::ShowGlasses:
245+
case DisplayIterator::ShowPour:
246+
if (idx == UnitIndex::U2) {
247+
myDisplay.clear(UnitIndex::U2);
248+
249+
myDisplay.printPosition(UnitIndex::U2, -1,
250+
myDisplay.getFontHeight(UnitIndex::U2) * 0,
251+
getFormattedBeerName(idx));
252+
myDisplay.printPosition(UnitIndex::U2, -1,
253+
myDisplay.getFontHeight(UnitIndex::U2) * 1,
254+
getFormattedPour(pour));
255+
myDisplay.printPosition(UnitIndex::U2, -1,
256+
myDisplay.getFontHeight(idx) * 2,
257+
getFormattedBeerWeight(beerWeight));
258+
259+
myDisplay.setFont(UnitIndex::U2, FontSize::FONT_10);
260+
myDisplay.printPosition(UnitIndex::U2, -1,
261+
myDisplay.getDisplayHeight(UnitIndex::U2) -
262+
myDisplay.getFontHeight(UnitIndex::U2),
263+
getFormattedIP());
264+
}
265+
break;
266+
}
267+
myDisplay.show(UnitIndex::U2);
268+
}
214269
}
215270

216271
void DisplayLayout::showHardwareStats(UnitIndex idx, bool isScaleConnected) {
@@ -231,13 +286,17 @@ void DisplayLayout::showHardwareStats(UnitIndex idx, bool isScaleConnected) {
231286
myLevelDetection.getStatsDetection(idx)->min(),
232287
myLevelDetection.getStatsDetection(idx)->max());
233288
myDisplay.printLine(idx, 3, &_buf[0]);
289+
290+
snprintf(&_buf[0], sizeof(_buf), "Raw wgt: %.3f",
291+
myLevelDetection.getTotalRawWeight(idx));
292+
myDisplay.printLine(idx, 4, &_buf[0]);
234293
}
235294

236295
myDisplay.show(idx);
237296
}
238297

239298
void DisplayLayout::showCurrent(UnitIndex idx, bool isScaleConnected,
240-
float beerWeight, float beerVoume,
299+
float beerWeight, float beerVolume,
241300
float glasses, float pour, float temp,
242301
bool stableLevel) {
243302
switch (myConfig.getDisplayLayoutType()) {
@@ -248,11 +307,11 @@ void DisplayLayout::showCurrent(UnitIndex idx, bool isScaleConnected,
248307
break;
249308

250309
case DisplayLayoutType::Graph:
251-
showGraph(idx, isScaleConnected, beerVoume, pour);
310+
showGraph(idx, isScaleConnected, beerVolume, pour);
252311
break;
253312

254313
case DisplayLayoutType::GraphOne:
255-
showGraphOne(idx, isScaleConnected, beerVoume);
314+
showGraphOne(idx, isScaleConnected, beerVolume, pour, beerWeight);
256315
break;
257316

258317
case DisplayLayoutType::HardwareStats:

src/displayout.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ class DisplayLayout {
107107
float glasses, float pour, float temp, bool stableLevel);
108108
void showGraph(UnitIndex idx, bool isScaleConnected, float beerVolume,
109109
float pour);
110-
void showGraphOne(UnitIndex idx, bool isScaleConnected, float beerVolume);
110+
void showGraphOne(UnitIndex idx, bool isScaleConnected, float beerVolume,
111+
float pour, float beerWeight);
111112
void showHardwareStats(UnitIndex idx, bool isScaleConnected);
112113

113114
public:

src/homeassist.cpp

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,48 +29,63 @@ SOFTWARE.
2929
#include <utils.hpp>
3030

3131
const char *volumeTemplate =
32+
"kegmon/${mdns}_volume${tap}/state:${volume}|"
33+
"kegmon/${mdns}_volume${tap}/"
34+
"attr:{\"glasses\":${glasses}}|"
3235
"homeassistant/sensor/${mdns}_volume${tap}/"
3336
"config:{\"device_class\":\"volume\",\"name\":\"${mdns}_volume${tap}\","
34-
"\"unit_of_measurement\":\"L\",\"state_topic\":\"homeassistant/sensor/"
35-
"${mdns}_volume${tap}/state\",\"json_attributes_topic\":\"homeassistant/"
36-
"sensor/${mdns}_volume${tap}/"
37-
"attr\",\"unique_id\":\"${mdns}_volume${tap}\"}|"
38-
"homeassistant/sensor/${mdns}_volume${tap}/state:${volume}|"
39-
"homeassistant/sensor/${mdns}_volume${tap}/"
40-
"attr:{\"glasses\":${glasses}}|";
37+
"\"unit_of_measurement\":\"L\",\"state_topic\":\"kegmon/"
38+
"${mdns}_volume${tap}/state\",\"json_attributes_topic\":\"kegmon/"
39+
"${mdns}_volume${tap}/"
40+
"attr\",\"unique_id\":\"${mdns}_volume${tap}\","
41+
"\"device\": { \"identifiers\": \"${mdns}_${id}\", \"name\": \"${mdns}\", "
42+
"\"model\": \"kegmon\", \"manufacturer\": \"mp-se\", \"sw_version\": "
43+
"\"${sw-ver}\" } }|";
4144

4245
const char *beerTemplate =
43-
"homeassistant/sensor/${mdns}_beer${tap}/config:"
44-
"{\"name\":\"${mdns}_beer${tap}\",\"state_topic\":\"homeassistant/sensor/"
45-
"${mdns}_beer${tap}/state\",\"json_attributes_topic\":\"homeassistant/"
46-
"sensor/${mdns}_beer${tap}/"
47-
"attr\",\"unique_id\":\"${mdns}_beer${tap}\"}|"
48-
"homeassistant/sensor/${mdns}_beer${tap}/state:${beer-name}|"
49-
"homeassistant/sensor/${mdns}_beer${tap}/"
46+
"kegmon/${mdns}_beer${tap}/state:${beer-name}|"
47+
"kegmon/${mdns}_beer${tap}/"
5048
"attr:{\"abv\":${beer-abv},\"abv\":${beer-abv},\"ibu\":${beer-ibu},\"ebc\":"
5149
"${beer-"
52-
"ebc}}|";
50+
"ebc}}|"
51+
"homeassistant/sensor/${mdns}_beer${tap}/config:"
52+
"{\"name\":\"${mdns}_beer${tap}\",\"state_topic\":\"kegmon/"
53+
"${mdns}_beer${tap}/state\",\"json_attributes_topic\":\"kegmon/"
54+
"${mdns}_beer${tap}/"
55+
"attr\",\"unique_id\":\"${mdns}_beer${tap}\","
56+
"\"device\": { \"identifiers\": \"${mdns}_${id}\", \"name\": \"${mdns}\", "
57+
"\"model\": \"kegmon\", \"manufacturer\": \"mp-se\", \"sw_version\": "
58+
"\"${sw-ver}\" } }|";
5359

5460
const char *pourTemplate =
61+
"kegmon/${mdns}_pour${tap}/state:${pour}|"
5562
"homeassistant/sensor/${mdns}_pour${tap}/config:"
5663
"{\"device_class\":\"volume\",\"name\":\"${mdns}_pour${tap}\",\"unit_of_"
57-
"measurement\":\"L\",\"state_topic\":\"homeassistant/sensor/"
58-
"${mdns}_pour${tap}/state\",\"unique_id\":\"${mdns}_pour${tap}\"}|"
59-
"homeassistant/sensor/${mdns}_pour${tap}/state:${pour}|";
64+
"measurement\":\"L\",\"state_topic\":\"kegmon/"
65+
"${mdns}_pour${tap}/state\",\"unique_id\":\"${mdns}_pour${tap}\", "
66+
"\"device\": { \"identifiers\": \"${mdns}_${id}\", \"name\": \"${mdns}\", "
67+
"\"model\": \"kegmon\", \"manufacturer\": \"mp-se\", \"sw_version\": "
68+
"\"${sw-ver}\" } }|";
6069

6170
const char *tempTemplate =
71+
"kegmon/${mdns}_temp/state:${temp}|"
6272
"homeassistant/sensor/${mdns}_temp/config:"
6373
"{\"device_class\":\"temperature\",\"name\":\"${mdns}_temp\",\"unit_of_"
64-
"measurement\":\"${temp-format}\",\"state_topic\":\"homeassistant/sensor/"
65-
"${mdns}_temp/state\",\"unique_id\":\"${mdns}_temp\"}|"
66-
"homeassistant/sensor/${mdns}_temp/state:${temp}|";
74+
"measurement\":\"${temp-format}\",\"state_topic\":\"kegmon/"
75+
"${mdns}_temp/state\",\"unique_id\":\"${mdns}_temp\", "
76+
"\"device\": { \"identifiers\": \"${mdns}_${id}\", \"name\": \"${mdns}\", "
77+
"\"model\": \"kegmon\", \"manufacturer\": \"mp-se\", \"sw_version\": "
78+
"\"${sw-ver}\" } }|";
6779

6880
void HomeAssist::sendTempInformation(float tempC) {
6981
if (!myConfig.hasTargetMqtt()) return;
82+
if (isnan(tempC)) return;
7083

7184
TemplatingEngine tpl;
7285

7386
tpl.setVal("${mdns}", myConfig.getMDNS());
87+
tpl.setVal("${sw-ver}", CFG_APPVER);
88+
tpl.setVal("${id}", myConfig.getID());
7489

7590
// if (myConfig.isTempFormatC()) {
7691
tpl.setVal("${temp}", tempC);
@@ -98,6 +113,7 @@ void HomeAssist::sendTapInformation(UnitIndex idx, float stableVol,
98113
TemplatingEngine tpl;
99114

100115
tpl.setVal("${mdns}", myConfig.getMDNS());
116+
tpl.setVal("${sw-ver}", CFG_APPVER);
101117
tpl.setVal("${id}", myConfig.getID());
102118
tpl.setVal("${volume}", stableVol, 3);
103119
tpl.setVal("${glasses}", glasses, 1);
@@ -131,6 +147,7 @@ void HomeAssist::sendPourInformation(UnitIndex idx, float pourVol) {
131147
TemplatingEngine tpl;
132148

133149
tpl.setVal("${mdns}", myConfig.getMDNS());
150+
tpl.setVal("${sw-ver}", CFG_APPVER);
134151
tpl.setVal("${id}", myConfig.getID());
135152
tpl.setVal("${pour}", pourVol, 3);
136153
tpl.setVal("${tap}", static_cast<int>(idx) + 1);

src/kegwebhandler.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ void KegWebHandler::setupWebHandlers() {
8484
// Note! For the async implementation the order matters
8585
_server->serveStatic("/levels2", LittleFS, LEVELS_FILENAME2);
8686
_server->serveStatic("/levels", LittleFS, LEVELS_FILENAME);
87+
_server->serveStatic("/startup", LittleFS, STARTUP_FILENAME);
8788
WS_BIND_URL("/api/reset", HTTP_GET, &KegWebHandler::webReset);
8889
WS_BIND_URL("/api/scale/tare", HTTP_GET, &KegWebHandler::webScaleTare);
8990
WS_BIND_URL("/api/scale/factor", HTTP_GET, &KegWebHandler::webScaleFactor);

0 commit comments

Comments
 (0)