Merge branch 'development'
This commit is contained in:
commit
545a18db6f
@ -268,6 +268,7 @@ Compatibility with OpenDTU is most likly related to the serial number of the inv
|
|||||||
Generated using: `git log --date=short --pretty=format:"* %h%x09%ad%x09%s" | grep BREAKING`
|
Generated using: `git log --date=short --pretty=format:"* %h%x09%ad%x09%s" | grep BREAKING`
|
||||||
|
|
||||||
```code
|
```code
|
||||||
|
* 59f43a8 2023-04-17 BREAKING CHANGE: Web API Endpoint /api/devinfo/status requires GET parameter inv=
|
||||||
* 318136d 2023-03-15 BREAKING CHANGE: Updated partition table: Make sure you have a configuration backup and completly reflash the device!
|
* 318136d 2023-03-15 BREAKING CHANGE: Updated partition table: Make sure you have a configuration backup and completly reflash the device!
|
||||||
* 3b7aef6 2023-02-13 BREAKING CHANGE: Web API!
|
* 3b7aef6 2023-02-13 BREAKING CHANGE: Web API!
|
||||||
* d4c838a 2023-02-06 BREAKING CHANGE: Prometheus API!
|
* d4c838a 2023-02-06 BREAKING CHANGE: Prometheus API!
|
||||||
|
|||||||
@ -66,6 +66,11 @@ bool HoymilesRadio::isInitialized()
|
|||||||
return _isInitialized;
|
return _isInitialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HoymilesRadio::isConfigured()
|
||||||
|
{
|
||||||
|
return _isConfigured;
|
||||||
|
}
|
||||||
|
|
||||||
bool HoymilesRadio::isIdle()
|
bool HoymilesRadio::isIdle()
|
||||||
{
|
{
|
||||||
return !_busyFlag;
|
return !_busyFlag;
|
||||||
|
|||||||
@ -13,6 +13,7 @@ public:
|
|||||||
|
|
||||||
bool isIdle();
|
bool isIdle();
|
||||||
bool isInitialized();
|
bool isInitialized();
|
||||||
|
bool isConfigured();
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T* enqueCommand()
|
T* enqueCommand()
|
||||||
@ -33,5 +34,6 @@ protected:
|
|||||||
serial_u _dtuSerial;
|
serial_u _dtuSerial;
|
||||||
std::queue<std::shared_ptr<CommandAbstract>> _commandQueue;
|
std::queue<std::shared_ptr<CommandAbstract>> _commandQueue;
|
||||||
bool _isInitialized = false;
|
bool _isInitialized = false;
|
||||||
|
bool _isConfigured = false;
|
||||||
bool _busyFlag = false;
|
bool _busyFlag = false;
|
||||||
};
|
};
|
||||||
@ -63,11 +63,12 @@ void HoymilesRadio_CMT::init(int8_t pin_sdio, int8_t pin_clk, int8_t pin_cs, int
|
|||||||
|
|
||||||
cmtSwitchDtuFreq(_inverterTargetFrequency); // start dtu at work freqency, for fast Rx if inverter is already on and frequency switched
|
cmtSwitchDtuFreq(_inverterTargetFrequency); // start dtu at work freqency, for fast Rx if inverter is already on and frequency switched
|
||||||
|
|
||||||
if (_radio->isChipConnected()) {
|
_isConfigured = true;
|
||||||
Hoymiles.getMessageOutput()->println("Connection successful");
|
if (!_radio->isChipConnected()) {
|
||||||
} else {
|
Hoymiles.getMessageOutput()->println("CMT: Connection error!!");
|
||||||
Hoymiles.getMessageOutput()->println("Connection error!!");
|
return;
|
||||||
}
|
}
|
||||||
|
Hoymiles.getMessageOutput()->println("CMT: Connection successful");
|
||||||
|
|
||||||
if (pin_gpio2 >= 0) {
|
if (pin_gpio2 >= 0) {
|
||||||
attachInterrupt(digitalPinToInterrupt(pin_gpio2), std::bind(&HoymilesRadio_CMT::handleInt1, this), RISING);
|
attachInterrupt(digitalPinToInterrupt(pin_gpio2), std::bind(&HoymilesRadio_CMT::handleInt1, this), RISING);
|
||||||
@ -109,7 +110,7 @@ void HoymilesRadio_CMT::loop()
|
|||||||
_radio->read(f.fragment, f.len);
|
_radio->read(f.fragment, f.len);
|
||||||
_rxBuffer.push(f);
|
_rxBuffer.push(f);
|
||||||
} else {
|
} else {
|
||||||
Hoymiles.getMessageOutput()->println("Buffer full");
|
Hoymiles.getMessageOutput()->println("CMT: Buffer full");
|
||||||
_radio->flush_rx();
|
_radio->flush_rx();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,11 +23,12 @@ void HoymilesRadio_NRF::init(SPIClass* initialisedSpiBus, uint8_t pinCE, uint8_t
|
|||||||
_radio->setAddressWidth(5);
|
_radio->setAddressWidth(5);
|
||||||
_radio->setRetries(0, 0);
|
_radio->setRetries(0, 0);
|
||||||
_radio->maskIRQ(true, true, false); // enable only receiving interrupts
|
_radio->maskIRQ(true, true, false); // enable only receiving interrupts
|
||||||
if (_radio->isChipConnected()) {
|
_isConfigured = true;
|
||||||
Hoymiles.getMessageOutput()->println("Connection successful");
|
if (!_radio->isChipConnected()) {
|
||||||
} else {
|
Hoymiles.getMessageOutput()->println("NRF: Connection error!!");
|
||||||
Hoymiles.getMessageOutput()->println("Connection error!!");
|
return;
|
||||||
}
|
}
|
||||||
|
Hoymiles.getMessageOutput()->println("NRF: Connection successful");
|
||||||
|
|
||||||
attachInterrupt(digitalPinToInterrupt(pinIRQ), std::bind(&HoymilesRadio_NRF::handleIntr, this), FALLING);
|
attachInterrupt(digitalPinToInterrupt(pinIRQ), std::bind(&HoymilesRadio_NRF::handleIntr, this), FALLING);
|
||||||
|
|
||||||
@ -60,7 +61,7 @@ void HoymilesRadio_NRF::loop()
|
|||||||
_radio->read(f.fragment, f.len);
|
_radio->read(f.fragment, f.len);
|
||||||
_rxBuffer.push(f);
|
_rxBuffer.push(f);
|
||||||
} else {
|
} else {
|
||||||
Hoymiles.getMessageOutput()->println("Buffer full");
|
Hoymiles.getMessageOutput()->println("NRF: Buffer full");
|
||||||
_radio->flush_rx();
|
_radio->flush_rx();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,7 +27,7 @@ build_unflags =
|
|||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
https://github.com/yubox-node-org/ESPAsyncWebServer
|
https://github.com/yubox-node-org/ESPAsyncWebServer
|
||||||
bblanchon/ArduinoJson @ ^6.21.1
|
bblanchon/ArduinoJson @ ^6.21.2
|
||||||
https://github.com/bertmelis/espMqttClient.git#v1.4.2
|
https://github.com/bertmelis/espMqttClient.git#v1.4.2
|
||||||
nrf24/RF24 @ ^1.4.5
|
nrf24/RF24 @ ^1.4.5
|
||||||
olikraus/U8g2 @ ^2.34.17
|
olikraus/U8g2 @ ^2.34.17
|
||||||
|
|||||||
@ -30,22 +30,27 @@ void WebApiDevInfoClass::onDevInfoStatus(AsyncWebServerRequest* request)
|
|||||||
AsyncJsonResponse* response = new AsyncJsonResponse();
|
AsyncJsonResponse* response = new AsyncJsonResponse();
|
||||||
JsonObject root = response->getRoot();
|
JsonObject root = response->getRoot();
|
||||||
|
|
||||||
for (uint8_t i = 0; i < Hoymiles.getNumInverters(); i++) {
|
uint64_t serial = 0;
|
||||||
auto inv = Hoymiles.getInverterByPos(i);
|
if (request->hasParam("inv")) {
|
||||||
|
String s = request->getParam("inv")->value();
|
||||||
|
serial = strtoll(s.c_str(), NULL, 16);
|
||||||
|
}
|
||||||
|
|
||||||
JsonObject devInfoObj = root[inv->serialString()].createNestedObject();
|
auto inv = Hoymiles.getInverterBySerial(serial);
|
||||||
devInfoObj["valid_data"] = inv->DevInfo()->getLastUpdate() > 0;
|
|
||||||
devInfoObj["fw_bootloader_version"] = inv->DevInfo()->getFwBootloaderVersion();
|
if (inv != nullptr) {
|
||||||
devInfoObj["fw_build_version"] = inv->DevInfo()->getFwBuildVersion();
|
root["valid_data"] = inv->DevInfo()->getLastUpdate() > 0;
|
||||||
devInfoObj["hw_part_number"] = inv->DevInfo()->getHwPartNumber();
|
root["fw_bootloader_version"] = inv->DevInfo()->getFwBootloaderVersion();
|
||||||
devInfoObj["hw_version"] = inv->DevInfo()->getHwVersion();
|
root["fw_build_version"] = inv->DevInfo()->getFwBuildVersion();
|
||||||
devInfoObj["hw_model_name"] = inv->DevInfo()->getHwModelName();
|
root["hw_part_number"] = inv->DevInfo()->getHwPartNumber();
|
||||||
devInfoObj["max_power"] = inv->DevInfo()->getMaxPower();
|
root["hw_version"] = inv->DevInfo()->getHwVersion();
|
||||||
|
root["hw_model_name"] = inv->DevInfo()->getHwModelName();
|
||||||
|
root["max_power"] = inv->DevInfo()->getMaxPower();
|
||||||
|
|
||||||
char timebuffer[32];
|
char timebuffer[32];
|
||||||
const time_t t = inv->DevInfo()->getFwBuildDateTime();
|
const time_t t = inv->DevInfo()->getFwBuildDateTime();
|
||||||
std::strftime(timebuffer, sizeof(timebuffer), "%Y-%m-%d %H:%M:%S", gmtime(&t));
|
std::strftime(timebuffer, sizeof(timebuffer), "%Y-%m-%d %H:%M:%S", gmtime(&t));
|
||||||
devInfoObj["fw_build_datetime"] = String(timebuffer);
|
root["fw_build_datetime"] = String(timebuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
response->setLength();
|
response->setLength();
|
||||||
|
|||||||
@ -69,11 +69,11 @@ void WebApiSysstatusClass::onSystemStatus(AsyncWebServerRequest* request)
|
|||||||
|
|
||||||
root["uptime"] = esp_timer_get_time() / 1000000;
|
root["uptime"] = esp_timer_get_time() / 1000000;
|
||||||
|
|
||||||
root["nrf_configured"] = Hoymiles.getRadioNrf()->isInitialized();
|
root["nrf_configured"] = Hoymiles.getRadioNrf()->isConfigured();
|
||||||
root["nrf_connected"] = Hoymiles.getRadioNrf()->isConnected();
|
root["nrf_connected"] = Hoymiles.getRadioNrf()->isConnected();
|
||||||
root["nrf_pvariant"] = Hoymiles.getRadioNrf()->isPVariant();
|
root["nrf_pvariant"] = Hoymiles.getRadioNrf()->isPVariant();
|
||||||
|
|
||||||
root["cmt_configured"] = Hoymiles.getRadioCmt()->isInitialized();
|
root["cmt_configured"] = Hoymiles.getRadioCmt()->isConfigured();
|
||||||
root["cmt_connected"] = Hoymiles.getRadioCmt()->isConnected();
|
root["cmt_connected"] = Hoymiles.getRadioCmt()->isConnected();
|
||||||
|
|
||||||
response->setLength();
|
response->setLength();
|
||||||
|
|||||||
@ -557,10 +557,10 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
onShowDevInfo(serial: number) {
|
onShowDevInfo(serial: number) {
|
||||||
this.devInfoLoading = true;
|
this.devInfoLoading = true;
|
||||||
fetch("/api/devinfo/status", { headers: authHeader() })
|
fetch("/api/devinfo/status?inv=" + serial, { headers: authHeader() })
|
||||||
.then((response) => handleResponse(response, this.$emitter, this.$router))
|
.then((response) => handleResponse(response, this.$emitter, this.$router))
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
this.devInfoList = data[serial][0];
|
this.devInfoList = data;
|
||||||
this.devInfoList.serial = serial;
|
this.devInfoList.serial = serial;
|
||||||
this.devInfoLoading = false;
|
this.devInfoLoading = false;
|
||||||
});
|
});
|
||||||
|
|||||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user