Skip to content

Commit

Permalink
close #50 "OLED - more precision for total yield" + also for TFT disp…
Browse files Browse the repository at this point in the history
…lay + extend web update UI with used arch type
  • Loading branch information
ohAnd committed Oct 10, 2024
1 parent fbb5fe3 commit 26aebf7
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 16 deletions.
11 changes: 11 additions & 0 deletions include/base/platformData.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ struct baseDataStruct
boolean esp32 = false;
String espUniqueName = String(AP_NAME_START) + "_" + chipID;

#if defined(ESP8266)
String chipType = "ESP8266";
#warning "setting chipType for ESP8266"
#elif CONFIG_IDF_TARGET_ESP32
String chipType = "ESP32";
#warning "setting chipType for ESP32"
#elif CONFIG_IDF_TARGET_ESP32S2
String chipType = "ESP32 S2 (LOLIN S2 Mini)";
#warning "setting chipType for ESP32S2"
#endif

const char *fwVersion = VERSION;
const char *fwBuildDate = BUILDTIME;

Expand Down
6 changes: 3 additions & 3 deletions include/version.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#define VERSION "2.0.150_localDev"
#define BUILDTIME "09.10.2024 - 09:02:52"
#define BUILDTIMESTAMP "1728457372"
#define VERSION "2.0.171_localDev"
#define BUILDTIME "10.10.2024 - 20:15:07"
#define BUILDTIMESTAMP "1728584107"
8 changes: 4 additions & 4 deletions include/version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version": "2.0.150_localDev",
"versiondate": "09.10.2024 - 09:02:52",
"linksnapshot": "https://github.com/ohAnd/dtuGateway/releases/download/snapshot/dtuGateway_snapshot_2.0.150_localDev.bin",
"link": "https://github.com/ohAnd/dtuGateway/releases/latest/download/dtuGateway_release_2.0.150_localDev.bin"
"version": "2.0.171_localDev",
"versiondate": "10.10.2024 - 20:15:07",
"linksnapshot": "https://github.com/ohAnd/dtuGateway/releases/download/snapshot/dtuGateway_snapshot_2.0.171_localDev.bin",
"link": "https://github.com/ohAnd/dtuGateway/releases/latest/download/dtuGateway_release_2.0.171_localDev.bin"
}
3 changes: 3 additions & 0 deletions include/web/index_html.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ const char INDEX_HTML[] PROGMEM = R"=====(
</div>
<div class="popup" id="updateMenu">
<h2>Update</h2>
<h6 id="chipType">controller architecture type: ...</h6>
<hr>
<div style="padding-bottom: 10px;">
<div style="padding-bottom: 10px;"></div>
Expand Down Expand Up @@ -668,6 +670,7 @@ const char INDEX_HTML[] PROGMEM = R"=====(
$('#rssitext_dtu').html(wifiDTUPercent + '%');
$('#firmware').html("fw version: " + data.firmware.version);
$('#chipType').html("controller architecture type: " + data.chipType);
if (data.firmware.selectedUpdateChannel == 0) { $("#relChanStable").addClass("selected"); $("#relChanSnapshot").removeClass("selected"); }
else { $("#relChanStable").removeClass("selected"); $("#relChanSnapshot").addClass("selected"); }
Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ So I decided to put this abstraction in an **ESP8266** to have a stable abstract
```json
{
"chipid": 123456,
"chipType": "ESP32",
"host": "dtuGateway_123456",
"initMode": 0,
"firmware": {
Expand Down
1 change: 1 addition & 0 deletions src/base/webserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ void DTUwebserver::handleInfojson(AsyncWebServerRequest *request)
{
String JSON = "{";
JSON = JSON + "\"chipid\": " + String(platformData.chipID) + ",";
JSON = JSON + "\"chipType\": \"" + platformData.chipType + "\",";
JSON = JSON + "\"host\": \"" + platformData.espUniqueName + "\",";
JSON = JSON + "\"initMode\": " + userConfig.wifiAPstart + ",";

Expand Down
15 changes: 10 additions & 5 deletions src/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,16 @@ void Display::drawFooter()
u8g2.drawRFrame(0 + offset_x, 54 + offset_y, 127, 14, 4);
// footer - content
u8g2.setFont(u8g2_font_5x7_tf);
// u8g2.drawStr(3 + offset_x, 57 + offset_y, lastDisplayData.formattedTime);
// u8g2.drawStr(3 + 11 * 4 + offset_x, 57 + offset_y, "FW:");
// u8g2.drawStr(3 + 11 * 4 + 4 * 4 + offset_x, 57 + offset_y, lastDisplayData.version);
u8g2.drawStr(3 + offset_x, 56 + offset_y, ("d: " + String(lastDisplayData.totalYieldDay, 3) + " kWh").c_str());
u8g2.drawStr(3 + 18 * 4 + offset_x, 56 + offset_y, ("t: " + String(lastDisplayData.totalYieldTotal, 0) + " kWh").c_str());

String yieldDay = String(lastDisplayData.totalYieldDay, 3) + " kWh";
u8g2.drawStr(3 + offset_x, 56 + offset_y, String("d:").c_str());
u8g2.drawStr(14 + offset_x, 56 + offset_y, yieldDay.c_str());

String yieldTotal = String(lastDisplayData.totalYieldTotal, 1) + " kWh";
u8g2_uint_t width = u8g2.getUTF8Width(yieldTotal.c_str());
int yieldTotal_xpos = (124 - width);
u8g2.drawStr(yieldTotal_xpos - 11 + offset_x, 56 + offset_y, String("t:").c_str());
u8g2.drawStr(yieldTotal_xpos + offset_x, 56 + offset_y, yieldTotal.c_str());
}

void Display::checkChangedValues()
Expand Down
11 changes: 7 additions & 4 deletions src/displayTFT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,15 @@ void DisplayTFT::drawFooter(String time)
tft.drawCentreString(time, 120, 174, 4);

tft.setTextColor(TFT_DARKCYAN, TFT_BLACK);
tft.drawCentreString("day", 85, 215, 1);
tft.drawCentreString("day", 85, 215, 1);
tft.drawCentreString("kWh", 120, 215, 1);
tft.drawCentreString("total", 155, 215, 1);
tft.drawCentreString("yield", 120, 225, 1);
tft.drawCentreString("total", 153, 215, 1);

tft.setTextColor(TFT_CYAN, TFT_BLACK);
tft.drawCentreString(String(lastDisplayData.totalYieldDay, 3) + " kWh", 85, 198, 2);
tft.drawCentreString(String(lastDisplayData.totalYieldTotal, 0) + " kWh", 160, 198, 2);
lastDisplayData.totalYieldTotal = 1055.7;
tft.drawCentreString(String(lastDisplayData.totalYieldDay, 3), 85, 198, 2);
tft.drawCentreString(String(lastDisplayData.totalYieldTotal, 1), 155, 198, 2);
}
else if (userConfig.displayNightClock) // if it is night then show the clock
{
Expand Down

0 comments on commit 26aebf7

Please sign in to comment.