diff --git a/lib/Hoymiles/src/parser/GridProfileParser.cpp b/lib/Hoymiles/src/parser/GridProfileParser.cpp index da1c80604..b6c1573b7 100644 --- a/lib/Hoymiles/src/parser/GridProfileParser.cpp +++ b/lib/Hoymiles/src/parser/GridProfileParser.cpp @@ -9,13 +9,16 @@ #include const std::array GridProfileParser::_profileTypes = { { - { 0x02, 0x00, "no data (yet)" }, - { 0x03, 0x00, "Germany - DE_VDE4105_2018" }, - { 0x0a, 0x00, "European - EN 50549-1:2019" }, - { 0x0c, 0x00, "AT Tor - EU_EN50438" }, - { 0x0d, 0x04, "France" }, - { 0x12, 0x00, "Poland - EU_EN50438" }, - { 0x37, 0x00, "Swiss - CH_NA EEA-NE7-CH2020" }, + { 0x02, 0x00, "US - NA_IEEE1547_240V" }, + { 0x03, 0x00, "DE - DE_VDE4105_2018" }, + { 0x03, 0x01, "XX - unknown" }, + { 0x0a, 0x00, "XX - EN 50549-1:2019" }, + { 0x0c, 0x00, "AT - AT_TOR_Erzeuger_default" }, + { 0x0d, 0x04, "FR -" }, + { 0x10, 0x00, "ES - ES_RD1699" }, + { 0x12, 0x00, "PL - EU_EN50438" }, + { 0x29, 0x00, "NL - NL_NEN-EN50549-1_2019" }, + { 0x37, 0x00, "CH - CH_NA EEA-NE7-CH2020" }, } }; constexpr frozen::map profileSection = { @@ -45,19 +48,19 @@ constexpr GridProfileItemDefinition_t make_value(frozen::string Name, frozen::st return v; } -constexpr frozen::map itemDefinitions = { +constexpr frozen::map itemDefinitions = { { 0x01, make_value("Nominale Voltage (NV)", "V", 10) }, { 0x02, make_value("Low Voltage 1 (LV1)", "V", 10) }, { 0x03, make_value("LV1 Maximum Trip Time (MTT)", "s", 10) }, { 0x04, make_value("High Voltage 1 (HV1)", "V", 10) }, { 0x05, make_value("HV1 Maximum Trip Time (MTT)", "s", 10) }, { 0x06, make_value("Low Voltage 2 (LV2)", "V", 10) }, - { 0x07, make_value("LV2 Maximum Trip Time (MTT)", "s", 10) }, + { 0x07, make_value("LV2 Maximum Trip Time (MTT)", "s", 100) }, { 0x08, make_value("High Voltage 2 (HV2)", "V", 10) }, - { 0x09, make_value("HV2 Maximum Trip Time (MTT)", "s", 10) }, + { 0x09, make_value("HV2 Maximum Trip Time (MTT)", "s", 100) }, { 0x0a, make_value("10mins Average High Voltage (AHV)", "V", 10) }, { 0x0b, make_value("High Voltage 3 (HV3)", "V", 10) }, - { 0x0c, make_value("HV3 Maximum Trip Time (MTT)", "s", 10) }, + { 0x0c, make_value("HV3 Maximum Trip Time (MTT)", "s", 100) }, { 0x0d, make_value("Nominal Frequency", "Hz", 100) }, { 0x0e, make_value("Low Frequency 1 (LF1)", "Hz", 100) }, { 0x0f, make_value("LF1 Maximum Trip Time (MTT)", "s", 10) }, @@ -94,7 +97,7 @@ constexpr frozen::map itemDefinition { 0x2e, make_value("Voltage Set Point V3", "V", 10) }, { 0x2f, make_value("Voltage Set Point V4", "V", 10) }, { 0x30, make_value("Reactive Set Point Q4", "%Pn", 10) }, - { 0x31, make_value("Setting Time (Tr)", "s", 10) }, + { 0x31, make_value("VV Setting Time (Tr)", "s", 10) }, { 0x32, make_value("SPF Function Activated", "bool", 1) }, { 0x33, make_value("Power Factor (PF)", "", 100) }, { 0x34, make_value("RPC Function Activated", "bool", 1) }, @@ -102,6 +105,15 @@ constexpr frozen::map itemDefinition { 0x36, make_value("WPF Function Activated", "bool", 1) }, { 0x37, make_value("Start of Power of WPF (Pstart)", "%Pn", 10) }, { 0x38, make_value("Power Factor ar Rated Power (PFRP)", "", 100) }, + { 0x39, make_value("Low Voltage 3 (LV3)", "V", 10) }, + { 0x3a, make_value("LV3 Maximum Trip Time (MTT)", "s", 100) }, + { 0x3b, make_value("Momentary Cessition Low Voltage", "V", 10) }, + { 0x3c, make_value("Momentary Cessition High Voltage", "V", 10) }, + { 0x3d, make_value("FW Settling Time (Tr)", "s", 10) }, + { 0x3e, make_value("LF2 Maximum Trip Time (MTT)", "s", 100) }, + { 0x3f, make_value("HF2 Maximum Trip time (MTT)", "s", 100) }, + { 0x40, make_value("Short Interruption Reconnect Time (SRT)", "s", 10) }, + { 0x41, make_value("Short Interruption Time (SIT)", "s", 10) }, { 0xff, make_value("Unkown Value", "", 1) }, }; @@ -114,6 +126,24 @@ const std::array GridProfileParse { 0x00, 0x00, 0x04 }, { 0x00, 0x00, 0x05 }, + // Version 0x01 + { 0x00, 0x01, 0x01 }, + { 0x00, 0x01, 0x02 }, + { 0x00, 0x01, 0x03 }, + { 0x00, 0x01, 0x04 }, + { 0x00, 0x01, 0x05 }, + { 0x00, 0x01, 0x08 }, + { 0x00, 0x01, 0x09 }, + + // Version 0x02 + { 0x00, 0x02, 0x01 }, + { 0x00, 0x02, 0x02 }, + { 0x00, 0x02, 0x03 }, + { 0x00, 0x02, 0x04 }, + { 0x00, 0x02, 0x05 }, + { 0x00, 0x02, 0x06 }, + { 0x00, 0x02, 0x07 }, + // Version 0x03 { 0x00, 0x03, 0x01 }, { 0x00, 0x03, 0x02 }, @@ -178,10 +208,10 @@ const std::array GridProfileParse { 0x00, 0x35, 0x07 }, { 0x00, 0x35, 0x08 }, { 0x00, 0x35, 0x09 }, - { 0x00, 0x35, 0xff }, - { 0x00, 0x35, 0xff }, - { 0x00, 0x35, 0xff }, - { 0x00, 0x35, 0xff }, + { 0x00, 0x35, 0x39 }, + { 0x00, 0x35, 0x3a }, + { 0x00, 0x35, 0x3b }, + { 0x00, 0x35, 0x3c }, // Frequency (H/LFRT) // Version 0x00 @@ -198,9 +228,9 @@ const std::array GridProfileParse { 0x10, 0x03, 0x10 }, { 0x10, 0x03, 0x11 }, { 0x10, 0x03, 0x12 }, - { 0x10, 0x03, 0x13 }, + { 0x10, 0x03, 0x3e }, { 0x10, 0x03, 0x14 }, - { 0x10, 0x03, 0x15 }, + { 0x10, 0x03, 0x3f }, // Island Detection (ID) // Version 0x00 @@ -220,8 +250,8 @@ const std::array GridProfileParse { 0x30, 0x07, 0x19 }, { 0x30, 0x07, 0x1a }, { 0x30, 0x07, 0x1b }, - { 0x30, 0x07, 0xff }, - { 0x30, 0x07, 0xff }, + { 0x30, 0x07, 0x40 }, + { 0x30, 0x07, 0x41 }, // Ramp Rates (RR) // Version 0x00 @@ -255,7 +285,7 @@ const std::array GridProfileParse { 0x50, 0x11, 0x1f }, { 0x50, 0x11, 0x20 }, { 0x50, 0x11, 0x21 }, - { 0x50, 0x11, 0x22 }, + { 0x50, 0x11, 0x3d }, // Volt Watt (VW) // Version 0x00 diff --git a/lib/Hoymiles/src/parser/GridProfileParser.h b/lib/Hoymiles/src/parser/GridProfileParser.h index 031891f3f..1be12e1d3 100644 --- a/lib/Hoymiles/src/parser/GridProfileParser.h +++ b/lib/Hoymiles/src/parser/GridProfileParser.h @@ -4,8 +4,8 @@ #include #define GRID_PROFILE_SIZE 141 -#define PROFILE_TYPE_COUNT 7 -#define SECTION_VALUE_COUNT 144 +#define PROFILE_TYPE_COUNT 10 +#define SECTION_VALUE_COUNT 158 typedef struct { uint8_t lIdx; diff --git a/platformio.ini b/platformio.ini index 16734b11a..02e48b996 100644 --- a/platformio.ini +++ b/platformio.ini @@ -19,12 +19,16 @@ extra_configs = custom_ci_action = generic,generic_esp32,generic_esp32s3,generic_esp32s3_usb framework = arduino -platform = espressif32@6.3.2 +platform = espressif32@6.5.0 build_flags = -DPIOENV=\"$PIOENV\" -D_TASK_STD_FUNCTION=1 - -Wall -Wextra -Werror -Wunused -Wmisleading-indentation -Wduplicated-cond -Wlogical-op -Wnull-dereference + -Wall -Wextra -Wunused -Wmisleading-indentation -Wduplicated-cond -Wlogical-op -Wnull-dereference +; Have to remove -Werror because of +; https://github.com/espressif/arduino-esp32/issues/9044 and +; https://github.com/espressif/arduino-esp32/issues/9045 +; -Werror -std=c++17 -std=gnu++17 build_unflags = diff --git a/src/Display_Graphic_Diagram.cpp b/src/Display_Graphic_Diagram.cpp index 489f295fa..0fd136184 100644 --- a/src/Display_Graphic_Diagram.cpp +++ b/src/Display_Graphic_Diagram.cpp @@ -62,20 +62,28 @@ void DisplayGraphicDiagramClass::updatePeriod() void DisplayGraphicDiagramClass::redraw(uint8_t screenSaverOffsetX) { - const uint8_t graphPosX = DIAG_POSX + ((screenSaverOffsetX > 3) ? 1 : 0); // screenSaverOffsetX expected to be in range 0..6 + // screenSaverOffsetX expected to be in range 0..6 + const uint8_t graphPosX = DIAG_POSX + ((screenSaverOffsetX > 3) ? 1 : 0); const uint8_t graphPosY = DIAG_POSY + ((screenSaverOffsetX > 3) ? 1 : 0); + const uint8_t horizontal_line_y = graphPosY + CHART_HEIGHT - 1; + const uint8_t arrow_size = 2; + // draw diagram axis _display->drawVLine(graphPosX, graphPosY, CHART_HEIGHT); - _display->drawHLine(graphPosX, graphPosY + CHART_HEIGHT - 1, CHART_WIDTH); + _display->drawHLine(graphPosX, horizontal_line_y, CHART_WIDTH); + + // UP-arrow + _display->drawLine(graphPosX, graphPosY, graphPosX + arrow_size, graphPosY + arrow_size); + _display->drawLine(graphPosX, graphPosY, graphPosX - arrow_size, graphPosY + arrow_size); - _display->drawLine(graphPosX + 1, graphPosY + 1, graphPosX + 2, graphPosY + 2); // UP-arrow - _display->drawLine(graphPosX - 2, graphPosY + 2, graphPosX - 1, graphPosY + 1); // UP-arrow - _display->drawLine(graphPosX + CHART_WIDTH - 3, graphPosY + CHART_HEIGHT - 3, graphPosX + CHART_WIDTH - 2, graphPosY + CHART_HEIGHT - 2); // LEFT-arrow - _display->drawLine(graphPosX + CHART_WIDTH - 3, graphPosY + CHART_HEIGHT + 1, graphPosX + CHART_WIDTH - 2, graphPosY + CHART_HEIGHT); // LEFT-arrow + // LEFT-arrow + _display->drawLine(graphPosX + CHART_WIDTH - 1, horizontal_line_y, graphPosX + CHART_WIDTH - 1 - arrow_size, horizontal_line_y - arrow_size); + _display->drawLine(graphPosX + CHART_WIDTH - 1, horizontal_line_y, graphPosX + CHART_WIDTH - 1 - arrow_size, horizontal_line_y + arrow_size); // draw AC value - _display->setFont(u8g2_font_tom_thumb_4x6_mr); // 4 pixels per char + // 4 pixels per char + _display->setFont(u8g2_font_tom_thumb_4x6_mr); char fmtText[7]; const float maxWatts = *std::max_element(_graphValues.begin(), _graphValues.end()); if (maxWatts > 999) { @@ -84,25 +92,24 @@ void DisplayGraphicDiagramClass::redraw(uint8_t screenSaverOffsetX) snprintf(fmtText, sizeof(fmtText), "%dW", static_cast(maxWatts)); } const uint8_t textLength = strlen(fmtText); - const uint8_t space_and_arrow_pixels = 2; - _display->drawStr(graphPosX - space_and_arrow_pixels - (textLength * 4), graphPosY + 5, fmtText); + _display->drawStr(graphPosX - arrow_size - textLength * 4, graphPosY + 5, fmtText); // draw chart const float scaleFactor = maxWatts / CHART_HEIGHT; uint8_t axisTick = 1; - for (int i = 0; i < _graphValuesCount; i++) { - if (scaleFactor > 0) { - if (i == 0) { - _display->drawPixel(graphPosX + 1 + i, graphPosY + CHART_HEIGHT - ((_graphValues[i] / scaleFactor) + 0.5)); // + 0.5 to round mathematical - } else { - _display->drawLine(graphPosX + i, graphPosY + CHART_HEIGHT - ((_graphValues[i - 1] / scaleFactor) + 0.5), graphPosX + 1 + i, graphPosY + CHART_HEIGHT - ((_graphValues[i] / scaleFactor) + 0.5)); - } - } - + for (uint8_t i = 1; i < _graphValuesCount; i++) { // draw one tick per hour to the x-axis if (i * getSecondsPerDot() > (3600u * axisTick)) { _display->drawPixel(graphPosX + 1 + i, graphPosY + CHART_HEIGHT); axisTick++; } + + if (scaleFactor == 0) { + continue; + } + + _display->drawLine( + graphPosX + i - 1, horizontal_line_y - std::max(0, _graphValues[i - 1] / scaleFactor - 0.5), + graphPosX + i, horizontal_line_y - std::max(0, _graphValues[i] / scaleFactor - 0.5)); } } diff --git a/webapp/package.json b/webapp/package.json index 60e57e946..91bfb1816 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -30,7 +30,7 @@ "@types/node": "^20.10.5", "@types/sortablejs": "^1.15.7", "@types/spark-md5": "^3.0.4", - "@vitejs/plugin-vue": "^4.5.2", + "@vitejs/plugin-vue": "^5.0.0", "@vue/eslint-config-typescript": "^12.0.0", "@vue/tsconfig": "^0.5.1", "eslint": "^8.56.0", @@ -42,6 +42,6 @@ "vite": "^5.0.10", "vite-plugin-compression": "^0.5.1", "vite-plugin-css-injected-by-js": "^3.3.1", - "vue-tsc": "^1.8.26" + "vue-tsc": "^1.8.27" } } diff --git a/webapp/yarn.lock b/webapp/yarn.lock index b3b54b482..904b3667e 100644 --- a/webapp/yarn.lock +++ b/webapp/yarn.lock @@ -547,10 +547,10 @@ resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.2.0.tgz#756641adb587851b5ccb3e095daf27ae581c8406" integrity sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ== -"@vitejs/plugin-vue@^4.5.2": - version "4.5.2" - resolved "https://registry.yarnpkg.com/@vitejs/plugin-vue/-/plugin-vue-4.5.2.tgz#1212d81bc83680e14448fefe55abd9fe1ed49ed1" - integrity sha512-UGR3DlzLi/SaVBPX0cnSyE37vqxU3O6chn8l0HJNzQzDia6/Au2A4xKv+iIJW8w2daf80G7TYHhi1pAUjdZ0bQ== +"@vitejs/plugin-vue@^5.0.0": + version "5.0.0" + resolved "https://registry.yarnpkg.com/@vitejs/plugin-vue/-/plugin-vue-5.0.0.tgz#8e8946548e6dfd9eb0391bbc282ec8e52103e0dd" + integrity sha512-7x5e8X4J1Wi4NxudGjJBd2OFerAi/0nzF80ojCzvfj347WVr0YSn82C8BSsgwSHzlk9Kw5xnZfj0/7RLnNwP5w== "@volar/language-core@1.11.1", "@volar/language-core@~1.11.1": version "1.11.1" @@ -690,10 +690,10 @@ "@typescript-eslint/parser" "^6.7.0" vue-eslint-parser "^9.3.1" -"@vue/language-core@1.8.26": - version "1.8.26" - resolved "https://registry.yarnpkg.com/@vue/language-core/-/language-core-1.8.26.tgz#7edb6b51a6ed57b618928500c3cbda9757a9f5f0" - integrity sha512-9cmza/Y2YTiOnKZ0Mi9zsNn7Irw+aKirP+5LLWVSNaL3fjKJjW1cD3HGBckasY2RuVh4YycvdA9/Q6EBpVd/7Q== +"@vue/language-core@1.8.27": + version "1.8.27" + resolved "https://registry.yarnpkg.com/@vue/language-core/-/language-core-1.8.27.tgz#2ca6892cb524e024a44e554e4c55d7a23e72263f" + integrity sha512-L8Kc27VdQserNaCUNiSFdDl9LWT24ly8Hpwf1ECy3aFb9m6bDhBGQYOujDm21N7EW3moKIOKEanQwe1q5BK+mA== dependencies: "@volar/language-core" "~1.11.1" "@volar/source-map" "~1.11.1" @@ -2605,13 +2605,13 @@ vue-template-compiler@^2.7.14: de-indent "^1.0.2" he "^1.2.0" -vue-tsc@^1.8.26: - version "1.8.26" - resolved "https://registry.yarnpkg.com/vue-tsc/-/vue-tsc-1.8.26.tgz#f66abd1dab4e4593590b2b7d4ede0a696882feec" - integrity sha512-jMEJ4aqU/l1hdgmeExH5h1TFoN+hbho0A2ZAhHy53/947DGm7Qj/bpB85VpECOCwV00h7JYNVnvoD2ceOorB4Q== +vue-tsc@^1.8.27: + version "1.8.27" + resolved "https://registry.yarnpkg.com/vue-tsc/-/vue-tsc-1.8.27.tgz#feb2bb1eef9be28017bb9e95e2bbd1ebdd48481c" + integrity sha512-WesKCAZCRAbmmhuGl3+VrdWItEvfoFIPXOvUJkjULi+x+6G/Dy69yO3TBRJDr9eUlmsNAwVmxsNZxvHKzbkKdg== dependencies: "@volar/typescript" "~1.11.1" - "@vue/language-core" "1.8.26" + "@vue/language-core" "1.8.27" semver "^7.5.4" vue@^3.3.13: