Skip to content

Commit

Permalink
Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
helgeerbe committed Jul 12, 2023
2 parents f329793 + 0d07b1a commit 633ef88
Show file tree
Hide file tree
Showing 10 changed files with 309 additions and 272 deletions.
4 changes: 4 additions & 0 deletions include/Datastore.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ class DatastoreClass {
// True if at least one inverter is producing
bool getIsAtLeastOneProducing();

// True if at least one inverter is enabled for polling
bool getIsAtLeastOnePollEnabled();

// True if all enabled inverters are producing
bool getIsAllEnabledProducing();

Expand All @@ -75,6 +78,7 @@ class DatastoreClass {
bool _isAtLeastOneProducing = false;
bool _isAllEnabledProducing = false;
bool _isAllEnabledReachable = false;
bool _isAtLeastOnePollEnabled = false;
};

extern DatastoreClass Datastore;
2 changes: 1 addition & 1 deletion lib/Hoymiles/src/inverters/HMS_Abstract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ HMS_Abstract::HMS_Abstract(HoymilesRadio* radio, uint64_t serial)

bool HMS_Abstract::sendChangeChannelRequest()
{
if (!(getEnableCommands() && getEnablePolling())) {
if (!(getEnableCommands() || getEnablePolling())) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Hoymiles/src/inverters/HMT_Abstract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ HMT_Abstract::HMT_Abstract(HoymilesRadio* radio, uint64_t serial)

bool HMT_Abstract::sendChangeChannelRequest()
{
if (!(getEnableCommands() && getEnablePolling())) {
if (!(getEnableCommands() || getEnablePolling())) {
return false;
}

Expand Down
11 changes: 8 additions & 3 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ extra_configs =
custom_ci_action = generic,generic_esp32,generic_esp32s3,generic_esp32s3_usb

framework = arduino
platform = espressif32@6.3.1
platform = espressif32@6.3.2

build_flags =
-DCOMPONENT_EMBED_FILES=webapp_dist/index.html.gz:webapp_dist/zones.json.gz:webapp_dist/favicon.ico:webapp_dist/favicon.png:webapp_dist/js/app.js.gz
Expand Down Expand Up @@ -64,11 +64,16 @@ build_flags = ${env.build_flags}


[env:generic_esp32c3]
board = esp32dev
board_build.mcu = esp32c3
board = esp32-c3-devkitc-02
custom_patches = esp32c3
build_flags = ${env.build_flags}

[env:generic_esp32c3_usb]
board = esp32-c3-devkitc-02
custom_patches = esp32c3
build_flags = ${env.build_flags}
-DARDUINO_USB_MODE=1
-DARDUINO_USB_CDC_ON_BOOT=1

[env:generic_esp32s3]
board = esp32-s3-devkitc-1
Expand Down
14 changes: 14 additions & 0 deletions src/Datastore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ void DatastoreClass::loop()

uint8_t isProducing = 0;
uint8_t isReachable = 0;
uint8_t pollEnabledCount = 0;

DAT_SEMAPHORE_TAKE();

Expand Down Expand Up @@ -62,6 +63,10 @@ void DatastoreClass::loop()
continue;
}

if (inv->getEnablePolling()) {
pollEnabledCount++;
}

if (inv->isProducing()) {
isProducing++;
} else {
Expand Down Expand Up @@ -107,6 +112,7 @@ void DatastoreClass::loop()

_isAtLeastOneProducing = isProducing > 0;
_isAtLeastOneReachable = isReachable > 0;
_isAtLeastOnePollEnabled = pollEnabledCount > 0;

_totalDcIrradiation = _totalDcIrradiationInstalled > 0 ? _totalDcPowerIrradiation / _totalDcIrradiationInstalled * 100.0f : 0;

Expand Down Expand Up @@ -235,3 +241,11 @@ bool DatastoreClass::getIsAllEnabledReachable()
DAT_SEMAPHORE_GIVE();
return retval;
}

bool DatastoreClass::getIsAtLeastOnePollEnabled()
{
DAT_SEMAPHORE_TAKE();
bool retval = _isAtLeastOnePollEnabled;
DAT_SEMAPHORE_GIVE();
return retval;
}
8 changes: 6 additions & 2 deletions src/InverterSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@
#include <Hoymiles.h>

// the NRF shall use the second externally usable HW SPI controller
// for ESP32 that is the so-called VSPI, for ESP32-S2/S3/C3 it is now called implicitly
// for ESP32 that is the so-called VSPI, for ESP32-S2/S3 it is now called implicitly
// HSPI, as it has shifted places for these chip generations
// for all generations, this is equivalent to SPI3_HOST in the lower level driver
#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
// For ESP32-C2, the only externally usable HW SPI controller is SPI2, its signal names
// being prefixed with FSPI.
#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
#define SPI_NRF HSPI
#elif CONFIG_IDF_TARGET_ESP32C3
#define SPI_NRF FSPI
#else
#define SPI_NRF VSPI
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/Led_Single.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void LedSingleClass::loop()

// Update inverter status
_ledState[1] = LedState_t::Off;
if (Hoymiles.getNumInverters()) {
if (Hoymiles.getNumInverters() && Datastore.getIsAtLeastOnePollEnabled()) {
// set LED status
if (Datastore.getIsAllEnabledReachable() && Datastore.getIsAllEnabledProducing()) {
_ledState[1] = LedState_t::On;
Expand Down
18 changes: 9 additions & 9 deletions webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,33 @@
"@popperjs/core": "^2.11.8",
"bootstrap": "^5.3.0",
"bootstrap-icons-vue": "^1.10.3",
"mitt": "^3.0.0",
"mitt": "^3.0.1",
"sortablejs": "^1.15.0",
"spark-md5": "^3.0.2",
"vue": "^3.3.4",
"vue-i18n": "^9.2.2",
"vue-router": "^4.2.2"
"vue-router": "^4.2.4"
},
"devDependencies": {
"@intlify/unplugin-vue-i18n": "^0.11.0",
"@intlify/unplugin-vue-i18n": "^0.12.2",
"@rushstack/eslint-patch": "^1.3.2",
"@tsconfig/node18": "^18.2.0",
"@types/bootstrap": "^5.2.6",
"@types/node": "^20.3.2",
"@types/node": "^20.4.1",
"@types/sortablejs": "^1.15.1",
"@types/spark-md5": "^3.0.2",
"@vitejs/plugin-vue": "^4.2.3",
"@vue/eslint-config-typescript": "^11.0.3",
"@vue/tsconfig": "^0.4.0",
"eslint": "^8.43.0",
"eslint": "^8.44.0",
"eslint-plugin-vue": "^9.15.1",
"npm-run-all": "^4.1.5",
"sass": "^1.63.6",
"terser": "^5.18.2",
"typescript": "^5.1.5",
"vite": "^4.3.9",
"typescript": "^5.1.6",
"vite": "^4.4.2",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-css-injected-by-js": "^3.1.2",
"vue-tsc": "^1.8.3"
"vite-plugin-css-injected-by-js": "^3.2.0",
"vue-tsc": "^1.8.4"
}
}
Loading

0 comments on commit 633ef88

Please sign in to comment.