Browse Source

add option for graph size

pull/1330/head
you69man 1 year ago
parent
commit
c82cc1c77e
  1. 4
      src/config/settings.h
  2. 2
      src/plugins/Display/Display.h
  3. 5
      src/plugins/Display/Display_Mono.h
  4. 3
      src/plugins/Display/Display_Mono_128X32.h
  5. 135
      src/plugins/Display/Display_Mono_128X64.h
  6. 3
      src/plugins/Display/Display_Mono_64X48.h
  7. 84
      src/plugins/Display/Display_Mono_84X48.h
  8. 1
      src/web/RestApi.h
  9. 15
      src/web/html/setup.html
  10. 1
      src/web/web.h

4
src/config/settings.h

@ -166,6 +166,7 @@ typedef struct {
bool pwrSaveAtIvOffline;
uint8_t screenSaver;
uint8_t graph_ratio;
uint8_t graph_size;
uint8_t rot;
//uint16_t wakeUp;
//uint16_t sleepAt;
@ -463,6 +464,7 @@ class settings {
mCfg.plugin.display.contrast = 60;
mCfg.plugin.display.screenSaver = 1; // default: 1 .. pixelshift for OLED for downward compatibility
mCfg.plugin.display.graph_ratio = 50;
mCfg.plugin.display.graph_size = 2;
mCfg.plugin.display.rot = 0;
mCfg.plugin.display.disp_data = DEF_PIN_OFF; // SDA
mCfg.plugin.display.disp_clk = DEF_PIN_OFF; // SCL
@ -700,6 +702,7 @@ class settings {
disp[F("pwrSafe")] = (bool)mCfg.plugin.display.pwrSaveAtIvOffline;
disp[F("screenSaver")] = mCfg.plugin.display.screenSaver;
disp[F("graph_ratio")] = mCfg.plugin.display.graph_ratio;
disp[F("graph_size")] = mCfg.plugin.display.graph_size;
disp[F("rotation")] = mCfg.plugin.display.rot;
//disp[F("wake")] = mCfg.plugin.display.wakeUp;
//disp[F("sleep")] = mCfg.plugin.display.sleepAt;
@ -717,6 +720,7 @@ class settings {
getVal<bool>(disp, F("pwrSafe"), &mCfg.plugin.display.pwrSaveAtIvOffline);
getVal<uint8_t>(disp, F("screenSaver"), &mCfg.plugin.display.screenSaver);
getVal<uint8_t>(disp, F("graph_ratio"), &mCfg.plugin.display.graph_ratio);
getVal<uint8_t>(disp, F("graph_size"), &mCfg.plugin.display.graph_size);
getVal<uint8_t>(disp, F("rotation"), &mCfg.plugin.display.rot);
//mCfg.plugin.display.wakeUp = disp[F("wake")];
//mCfg.plugin.display.sleepAt = disp[F("sleep")];

2
src/plugins/Display/Display.h

@ -54,7 +54,7 @@ class Display {
default: mMono = NULL; break;
}
if(mMono) {
mMono->config(mCfg->pwrSaveAtIvOffline, mCfg->screenSaver, mCfg->contrast, mCfg->graph_ratio);
mMono->config(mCfg->pwrSaveAtIvOffline, mCfg->screenSaver, mCfg->contrast, mCfg->graph_ratio, mCfg->graph_size);
mMono->init(mCfg->type, mCfg->rot, mCfg->disp_cs, mCfg->disp_dc, 0xff, mCfg->disp_clk, mCfg->disp_data, &mDisplayData);
}

5
src/plugins/Display/Display_Mono.h

@ -26,7 +26,7 @@ class DisplayMono {
DisplayMono() {};
virtual void init(uint8_t type, uint8_t rot, uint8_t cs, uint8_t dc, uint8_t reset, uint8_t clock, uint8_t data, DisplayData *displayData) = 0;
virtual void config(bool enPowerSave, uint8_t screenSaver, uint8_t lum, uint8_t graph_ratio) = 0;
virtual void config(bool enPowerSave, uint8_t screenSaver, uint8_t lum, uint8_t graph_ratio, uint8_t graph_size) = 0;
virtual void disp(void) = 0;
// Common loop function, manages display on/off functions for powersave and screensaver with motionsensor
@ -85,6 +85,7 @@ class DisplayMono {
uint8_t mScreenSaver = 1; // 0 .. off; 1 .. pixelShift; 2 .. motionsensor
uint8_t mLuminance;
uint8_t mGraphRatio;
uint8_t mGraphSize;
uint8_t mLoopCnt;
uint8_t mLineXOffsets[5] = {};
@ -119,7 +120,7 @@ class DisplayMono {
if (mGraphRatio == 100) // if graph ratio is 100% start in graph mode
mDispSwitchState = d_POWER_GRAPH;
else if (mGraphRatio != 0)
mDispSwitchTime.startTimeMonitor(150 * (100 - mGraphRatio)); // start time monitor only if ratio is neither 0 nor 100
mDispSwitchTime.startTimeMonitor(150 * (100 - mGraphRatio)); // start display mode change only if ratio is neither 0 nor 100
}
bool monoMaintainDispSwitchState(void) {

3
src/plugins/Display/Display_Mono_128X32.h

@ -12,11 +12,12 @@ class DisplayMono128X32 : public DisplayMono {
mExtra = 0;
}
void config(bool enPowerSave, uint8_t screenSaver, uint8_t lum, uint8_t graph_ratio) {
void config(bool enPowerSave, uint8_t screenSaver, uint8_t lum, uint8_t graph_ratio, uint8_t graph_size) {
mEnPowerSave = enPowerSave;
mScreenSaver = screenSaver;
mLuminance = lum;
mGraphRatio = graph_ratio;
mGraphSize = graph_size;
}
void init(uint8_t type, uint8_t rotation, uint8_t cs, uint8_t dc, uint8_t reset, uint8_t clock, uint8_t data, DisplayData *displayData) {

135
src/plugins/Display/Display_Mono_128X64.h

@ -12,11 +12,12 @@ class DisplayMono128X64 : public DisplayMono {
mExtra = 0;
}
void config(bool enPowerSave, uint8_t screenSaver, uint8_t lum, uint8_t graph_ratio) {
void config(bool enPowerSave, uint8_t screenSaver, uint8_t lum, uint8_t graph_ratio, uint8_t graph_size) {
mEnPowerSave = enPowerSave;
mScreenSaver = screenSaver;
mLuminance = lum;
mGraphRatio = graph_ratio;
mGraphSize = graph_size;
}
void init(uint8_t type, uint8_t rotation, uint8_t cs, uint8_t dc, uint8_t reset, uint8_t clock, uint8_t data, DisplayData *displayData) {
@ -35,7 +36,33 @@ class DisplayMono128X64 : public DisplayMono {
}
calcLinePositions();
initPowerGraph(mDispWidth - 20, mLineYOffsets[4] - mLineYOffsets[1]);
switch(mGraphSize) { // var opts2 = [[0, "Line 1 - 2"], [1, "Line 2 - 3"], [2, "Line 1 - 3"], [3, "Line 2 - 4"], [4, "Line 1 - 4"]];
case 0:
graph_first_line = 1;
graph_last_line = 2;
break;
case 1:
graph_first_line = 2;
graph_last_line = 3;
break;
case 2:
graph_first_line = 1;
graph_last_line = 3;
break;
case 3:
graph_first_line = 2;
graph_last_line = 4;
break;
case 4:
default:
graph_first_line = 1;
graph_last_line = 4;
break;
}
widthShrink = (mScreenSaver == 1) ? pixelShiftRange : 0; // shrink graphwidth for pixelshift screensaver
initPowerGraph(mDispWidth - 22 - widthShrink, mLineYOffsets[graph_last_line] - mLineYOffsets[graph_first_line - 1] - 2);
printText("Ahoy!", l_Ahoy, 0xff);
printText("ahoydtu.de", l_Website, 0xff);
@ -73,46 +100,47 @@ class DisplayMono128X64 : public DisplayMono {
if (0 != mDisplayData->utcTs)
printText(ah::getDateTimeStrShort(gTimezone.toLocal(mDisplayData->utcTs)).c_str(), l_Time, 0xff);
// alternatively:
// print ip address
if (!(mExtra % 5) && (mDisplayData->ipAddress)) {
snprintf(mFmtText, DISP_FMT_TEXT_LEN, "%s", (mDisplayData->ipAddress).toString().c_str());
printText(mFmtText, l_Status, 0xff);
}
// print status of inverters
else {
sun_pos = -1;
moon_pos = -1;
setLineFont(l_Status);
if (0 == mDisplayData->nrSleeping + mDisplayData->nrProducing)
snprintf(mFmtText, DISP_FMT_TEXT_LEN, "no inverter");
else if (0 == mDisplayData->nrSleeping) {
snprintf(mFmtText, DISP_FMT_TEXT_LEN, " ");
sun_pos = 0;
}
else if (0 == mDisplayData->nrProducing) {
snprintf(mFmtText, DISP_FMT_TEXT_LEN, " ");
moon_pos = 0;
if (showLine(l_Status)) {
// alternatively:
// print ip address
if (!(mExtra % 5) && (mDisplayData->ipAddress)) {
snprintf(mFmtText, DISP_FMT_TEXT_LEN, "%s", (mDisplayData->ipAddress).toString().c_str());
printText(mFmtText, l_Status, 0xff);
}
// print status of inverters
else {
snprintf(mFmtText, DISP_FMT_TEXT_LEN, "%2d", mDisplayData->nrProducing);
sun_pos = mDisplay->getStrWidth(mFmtText) + 1;
snprintf(mFmtText+2, DISP_FMT_TEXT_LEN, " %2d", mDisplayData->nrSleeping);
moon_pos = mDisplay->getStrWidth(mFmtText) + 1;
snprintf(mFmtText+7, DISP_FMT_TEXT_LEN, " ");
sun_pos = -1;
moon_pos = -1;
setLineFont(l_Status);
if (0 == mDisplayData->nrSleeping + mDisplayData->nrProducing)
snprintf(mFmtText, DISP_FMT_TEXT_LEN, "no inverter");
else if (0 == mDisplayData->nrSleeping) {
snprintf(mFmtText, DISP_FMT_TEXT_LEN, " ");
sun_pos = 0;
}
else if (0 == mDisplayData->nrProducing) {
snprintf(mFmtText, DISP_FMT_TEXT_LEN, " ");
moon_pos = 0;
}
else {
snprintf(mFmtText, DISP_FMT_TEXT_LEN, "%2d", mDisplayData->nrProducing);
sun_pos = mDisplay->getStrWidth(mFmtText) + 1;
snprintf(mFmtText+2, DISP_FMT_TEXT_LEN, " %2d", mDisplayData->nrSleeping);
moon_pos = mDisplay->getStrWidth(mFmtText) + 1;
snprintf(mFmtText+7, DISP_FMT_TEXT_LEN, " ");
}
printText(mFmtText, l_Status, 0xff);
pos = (mDispWidth - mDisplay->getStrWidth(mFmtText)) / 2;
mDisplay->setFont(u8g2_font_ncenB08_symbols8_ahoy);
if (sun_pos!=-1)
mDisplay->drawStr(pos + sun_pos + mPixelshift, mLineYOffsets[l_Status], "G"); // sun symbol
if (moon_pos!=-1)
mDisplay->drawStr(pos + moon_pos + mPixelshift, mLineYOffsets[l_Status], "H"); // moon symbol
}
printText(mFmtText, l_Status, 0xff);
pos = (mDispWidth - mDisplay->getStrWidth(mFmtText)) / 2;
mDisplay->setFont(u8g2_font_ncenB08_symbols8_ahoy);
if (sun_pos!=-1)
mDisplay->drawStr(pos + sun_pos + mPixelshift, mLineYOffsets[l_Status], "G"); // sun symbol
if (moon_pos!=-1)
mDisplay->drawStr(pos + moon_pos + mPixelshift, mLineYOffsets[l_Status], "H"); // moon symbol
}
if (mDispSwitchState == d_POWER_TEXT) {
if (showLine(l_TotalPower)) {
// print total power
if (mDisplayData->nrProducing > 0) {
if (mDisplayData->totalPower > 9999.0)
@ -124,8 +152,10 @@ class DisplayMono128X64 : public DisplayMono {
} else {
printText("offline", l_TotalPower, 0xff);
}
}
// print yields
if (showLine(l_YieldDay)) {
// print day yield
mDisplay->setFont(u8g2_font_ncenB10_symbols10_ahoy);
mDisplay->drawStr(16 + mPixelshift, mLineYOffsets[l_YieldDay], "I"); // day symbol
mDisplay->drawStr(16 + mPixelshift, mLineYOffsets[l_YieldTotal], "D"); // total symbol
@ -135,45 +165,44 @@ class DisplayMono128X64 : public DisplayMono {
else
snprintf(mFmtText, DISP_FMT_TEXT_LEN, "%.0f Wh", mDisplayData->totalYieldDay);
printText(mFmtText, l_YieldDay, 0xff);
}
if (showLine(l_YieldTotal)) {
// print total yield
if (mDisplayData->totalYieldTotal > 9999.0)
snprintf(mFmtText, DISP_FMT_TEXT_LEN, "%.2f MWh", mDisplayData->totalYieldTotal / 1000.0);
else
snprintf(mFmtText, DISP_FMT_TEXT_LEN, "%.0f kWh", mDisplayData->totalYieldTotal);
printText(mFmtText, l_YieldTotal, 0xff);
}
} else {
if (mDispSwitchState == d_POWER_GRAPH) {
// plot power graph
plotPowerGraph(10 + mPixelshift, mLineYOffsets[4] - 1);
plotPowerGraph((mDispWidth - mPgWidth) / 2 + mPixelshift, mLineYOffsets[graph_last_line] - 1);
}
// draw dynamic RSSI bars
int xoffs;
if (mScreenSaver == 1) // shrink screenwidth for pixelshift screensaver
xoffs = pixelShiftRange/2;
else
xoffs = 0;
int rssi_bar_height = 9;
for (int i = 0; i < 4; i++) {
int radio_rssi_threshold = -60 - i * 10;
int wifi_rssi_threshold = -60 - i * 10;
uint8_t barwidth = std::min(4 - i, 3);
if (mDisplayData->RadioRSSI > radio_rssi_threshold)
mDisplay->drawBox(xoffs + mPixelshift, 8 + (rssi_bar_height + 1) * i, barwidth, rssi_bar_height);
mDisplay->drawBox(widthShrink / 2 + mPixelshift, 8 + (rssi_bar_height + 1) * i, barwidth, rssi_bar_height);
if (mDisplayData->WifiRSSI > wifi_rssi_threshold)
mDisplay->drawBox(mDispWidth - barwidth - xoffs + mPixelshift, 8 + (rssi_bar_height + 1) * i, barwidth, rssi_bar_height);
mDisplay->drawBox(mDispWidth - barwidth - widthShrink / 2 + mPixelshift, 8 + (rssi_bar_height + 1) * i, barwidth, rssi_bar_height);
}
// draw dynamic antenna and WiFi symbols
mDisplay->setFont(u8g2_font_ncenB10_symbols10_ahoy);
char sym[]=" ";
sym[0] = mDisplayData->RadioSymbol?'A':'E'; // NRF
mDisplay->drawStr(xoffs + mPixelshift, mLineYOffsets[l_RSSI], sym);
mDisplay->drawStr(widthShrink / 2 + mPixelshift, mLineYOffsets[l_RSSI], sym);
if (mDisplayData->MQTTSymbol)
sym[0] = 'J'; // MQTT
else
sym[0] = mDisplayData->WifiSymbol?'B':'F'; // Wifi
mDisplay->drawStr(mDispWidth - mDisplay->getStrWidth(sym) - xoffs + mPixelshift, mLineYOffsets[l_RSSI], sym);
mDisplay->drawStr(mDispWidth - mDisplay->getStrWidth(sym) - widthShrink / 2 + mPixelshift, mLineYOffsets[l_RSSI], sym);
mDisplay->sendBuffer();
mExtra++;
@ -197,7 +226,11 @@ class DisplayMono128X64 : public DisplayMono {
l_MAX_LINES = 5,
};
uint8_t graph_first_line;
uint8_t graph_last_line;
const uint8_t pixelShiftRange = 11; // number of pixels to shift from left to right (centered -> must be odd!)
uint8_t widthShrink;
void calcLinePositions() {
uint8_t yOff = 0;
@ -239,4 +272,8 @@ class DisplayMono128X64 : public DisplayMono {
dispX += mPixelshift;
mDisplay->drawStr(dispX, mLineYOffsets[line], text);
}
bool showLine(uint8_t line) {
return ((mDispSwitchState == d_POWER_TEXT) || ((line < graph_first_line) || (line > graph_last_line)));
}
};

3
src/plugins/Display/Display_Mono_64X48.h

@ -12,11 +12,12 @@ class DisplayMono64X48 : public DisplayMono {
mExtra = 0;
}
void config(bool enPowerSave, uint8_t screenSaver, uint8_t lum, uint8_t graph_ratio) {
void config(bool enPowerSave, uint8_t screenSaver, uint8_t lum, uint8_t graph_ratio, uint8_t graph_size) {
mEnPowerSave = enPowerSave;
mScreenSaver = screenSaver;
mLuminance = lum;
mGraphRatio = graph_ratio;
mGraphSize = graph_size;
}
void init(uint8_t type, uint8_t rotation, uint8_t cs, uint8_t dc, uint8_t reset, uint8_t clock, uint8_t data, DisplayData *displayData) {

84
src/plugins/Display/Display_Mono_84X48.h

@ -12,11 +12,12 @@ class DisplayMono84X48 : public DisplayMono {
mExtra = 0;
}
void config(bool enPowerSave, uint8_t screenSaver, uint8_t lum, uint8_t graph_ratio) {
void config(bool enPowerSave, uint8_t screenSaver, uint8_t lum, uint8_t graph_ratio, uint8_t graph_size) {
mEnPowerSave = enPowerSave;
mScreenSaver = screenSaver;
mLuminance = lum;
mGraphRatio = graph_ratio;
mGraphSize = graph_size;
}
void init(uint8_t type, uint8_t rotation, uint8_t cs, uint8_t dc, uint8_t reset, uint8_t clock, uint8_t data, DisplayData *displayData) {
@ -24,7 +25,31 @@ class DisplayMono84X48 : public DisplayMono {
monoInit(new U8G2_PCD8544_84X48_F_4W_SW_SPI(rot, clock, data, cs, dc, reset), type, displayData);
calcLinePositions();
initPowerGraph(mDispWidth - 16, mLineYOffsets[4] - mLineYOffsets[1] - 2);
switch(mGraphSize) { // var opts2 = [[0, "Line 1 - 2"], [1, "Line 2 - 3"], [2, "Line 1 - 3"], [3, "Line 2 - 4"], [4, "Line 1 - 4"]];
case 0:
graph_first_line = 1;
graph_last_line = 2;
break;
case 1:
graph_first_line = 2;
graph_last_line = 3;
break;
case 2:
graph_first_line = 1;
graph_last_line = 3;
break;
case 3:
graph_first_line = 2;
graph_last_line = 4;
break;
case 4:
default:
graph_first_line = 1;
graph_last_line = 4;
break;
}
initPowerGraph(mDispWidth - 16, mLineYOffsets[graph_last_line] - mLineYOffsets[graph_first_line - 1] - 2);
printText("Ahoy!", l_Ahoy, 0xff);
printText("ahoydtu.de", l_Website, 0xff);
@ -57,27 +82,28 @@ class DisplayMono84X48 : public DisplayMono {
if (0 != mDisplayData->utcTs)
printText(ah::getDateTimeStrShort(gTimezone.toLocal(mDisplayData->utcTs)).c_str(), l_Time, 0xff);
// alternatively:
// print ip address
if (!(mExtra % 5) && (mDisplayData->ipAddress)) {
snprintf(mFmtText, DISP_FMT_TEXT_LEN, "%s", (mDisplayData->ipAddress).toString().c_str());
printText(mFmtText, l_Status, 0xff);
}
// print status of inverters
else {
if (0 == mDisplayData->nrSleeping + mDisplayData->nrProducing)
snprintf(mFmtText, DISP_FMT_TEXT_LEN, "no inverter");
else if (0 == mDisplayData->nrSleeping)
snprintf(mFmtText, DISP_FMT_TEXT_LEN, "\x86"); // sun symbol
else if (0 == mDisplayData->nrProducing)
snprintf(mFmtText, DISP_FMT_TEXT_LEN, "\x87"); // moon symbol
else
snprintf(mFmtText, DISP_FMT_TEXT_LEN, "%d\x86 %d\x87", mDisplayData->nrProducing, mDisplayData->nrSleeping);
printText(mFmtText, l_Status, 0xff);
if (showLine(l_Status)) {
// alternatively:
// print ip address
if (!(mExtra % 5) && (mDisplayData->ipAddress)) {
snprintf(mFmtText, DISP_FMT_TEXT_LEN, "%s", (mDisplayData->ipAddress).toString().c_str());
printText(mFmtText, l_Status, 0xff);
}
// print status of inverters
else {
if (0 == mDisplayData->nrSleeping + mDisplayData->nrProducing)
snprintf(mFmtText, DISP_FMT_TEXT_LEN, "no inverter");
else if (0 == mDisplayData->nrSleeping)
snprintf(mFmtText, DISP_FMT_TEXT_LEN, "\x86"); // sun symbol
else if (0 == mDisplayData->nrProducing)
snprintf(mFmtText, DISP_FMT_TEXT_LEN, "\x87"); // moon symbol
else
snprintf(mFmtText, DISP_FMT_TEXT_LEN, "%d\x86 %d\x87", mDisplayData->nrProducing, mDisplayData->nrSleeping);
printText(mFmtText, l_Status, 0xff);
}
}
if (mDispSwitchState == d_POWER_TEXT) {
if (showLine(l_TotalPower)) {
// print total power
if (mDisplayData->nrProducing > 0) {
if (mDisplayData->totalPower > 9999.0)
@ -89,7 +115,9 @@ class DisplayMono84X48 : public DisplayMono {
} else {
printText("offline", l_TotalPower, 0xff);
}
}
if (showLine(l_YieldDay)) {
// print day yield
printText("\x88", l_YieldDay, 10); // day symbol
if (mDisplayData->totalYieldDay > 9999.0)
@ -97,7 +125,9 @@ class DisplayMono84X48 : public DisplayMono {
else
snprintf(mFmtText, DISP_FMT_TEXT_LEN, "%.0f Wh", mDisplayData->totalYieldDay);
printText(mFmtText, l_YieldDay, 0xff);
}
if (showLine(l_YieldTotal)) {
// print total yield
printText("\x83", l_YieldTotal, 10); // total symbol
if (mDisplayData->totalYieldTotal > 9999.0)
@ -105,10 +135,11 @@ class DisplayMono84X48 : public DisplayMono {
else
snprintf(mFmtText, DISP_FMT_TEXT_LEN, "%.0f kWh", mDisplayData->totalYieldTotal);
printText(mFmtText, l_YieldTotal, 0xff);
}
} else {
if (mDispSwitchState == d_POWER_GRAPH) {
// plot power graph
plotPowerGraph(8, mLineYOffsets[4] - 1);
plotPowerGraph(8, mLineYOffsets[graph_last_line] - 1);
}
// draw dynamic RSSI bars
@ -155,6 +186,9 @@ class DisplayMono84X48 : public DisplayMono {
l_MAX_LINES = 5,
};
uint8_t graph_first_line;
uint8_t graph_last_line;
void calcLinePositions() {
uint8_t yOff = 0;
uint8_t i = 0;
@ -191,6 +225,10 @@ class DisplayMono84X48 : public DisplayMono {
dispX = col;
mDisplay->drawStr(dispX, mLineYOffsets[line], text);
}
bool showLine(uint8_t line) {
return ((mDispSwitchState == d_POWER_TEXT) || ((line < graph_first_line) || (line > graph_last_line)));
}
};

1
src/web/RestApi.h

@ -677,6 +677,7 @@ class RestApi {
obj[F("disp_rot")] = (uint8_t)mConfig->plugin.display.rot;
obj[F("disp_cont")] = (uint8_t)mConfig->plugin.display.contrast;
obj[F("disp_graph_ratio")] = (uint8_t)mConfig->plugin.display.graph_ratio;
obj[F("disp_graph_size")] = (uint8_t)mConfig->plugin.display.graph_size;
obj[F("disp_clk")] = (mConfig->plugin.display.type == 0) ? DEF_PIN_OFF : mConfig->plugin.display.disp_clk;
obj[F("disp_data")] = (mConfig->plugin.display.type == 0) ? DEF_PIN_OFF : mConfig->plugin.display.disp_data;
obj[F("disp_cs")] = (mConfig->plugin.display.type < 3) ? DEF_PIN_OFF : mConfig->plugin.display.disp_cs;

15
src/web/html/setup.html

@ -295,10 +295,7 @@
<div id="dispPins"></div>
<div id="pirPin"></div>
<p class="des">Graph options</p>
<div class="row mb-3">
<div class="col-12 col-sm-3 my-2">Graph Size</div>
<div class="col-12 col-sm-9"><input type="number" name="graph_size" min="0" max="255"></select></div>
</div>
<div id="graphSize"></div>
<div class="row mb-3">
<div class="col-12 col-sm-3 my-2">Show ratio (0-100 %)</div>
<div class="col-12 col-sm-9"><input type="number" name="disp_graph_ratio" min="0" max="100"></select></div>
@ -1098,6 +1095,16 @@
document.getElementsByName("disp_graph_ratio")[0].value = obj["disp_graph_ratio"];
var opts2 = [[0, "Line 1 - 2"], [1, "Line 2 - 3"], [2, "Line 1 - 3"], [3, "Line 2 - 4"], [4, "Line 1 - 4"]];
var graph_size_sel = sel("disp_graph_size", opts2, obj["disp_graph_size"]);
graph_size_sel.id = 'disp_graph_size';
document.getElementById("graphSize").append(
ml("div", {class: "row mb-3"}, [
ml("div", {class: "col-12 col-sm-3 my-2"}, "Graph size"),
ml("div", {class: "col-12 col-sm-9"}, graph_size_sel)
])
);
hideDispPins(pins, obj.disp_typ);
}

1
src/web/web.h

@ -585,6 +585,7 @@ class Web {
mConfig->plugin.display.pwrSaveAtIvOffline = (request->arg("disp_pwr") == "on");
mConfig->plugin.display.screenSaver = request->arg("disp_screensaver").toInt();
mConfig->plugin.display.graph_ratio = request->arg("disp_graph_ratio").toInt();
mConfig->plugin.display.graph_size = request->arg("disp_graph_size").toInt();
mConfig->plugin.display.rot = request->arg("disp_rot").toInt();
mConfig->plugin.display.type = request->arg("disp_typ").toInt();
mConfig->plugin.display.contrast = (mConfig->plugin.display.type == 0) ? 60 : request->arg("disp_cont").toInt();

Loading…
Cancel
Save