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`
|
||||
|
||||
```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!
|
||||
* 3b7aef6 2023-02-13 BREAKING CHANGE: Web API!
|
||||
* d4c838a 2023-02-06 BREAKING CHANGE: Prometheus API!
|
||||
|
||||
@ -66,6 +66,11 @@ bool HoymilesRadio::isInitialized()
|
||||
return _isInitialized;
|
||||
}
|
||||
|
||||
bool HoymilesRadio::isConfigured()
|
||||
{
|
||||
return _isConfigured;
|
||||
}
|
||||
|
||||
bool HoymilesRadio::isIdle()
|
||||
{
|
||||
return !_busyFlag;
|
||||
|
||||
@ -13,6 +13,7 @@ public:
|
||||
|
||||
bool isIdle();
|
||||
bool isInitialized();
|
||||
bool isConfigured();
|
||||
|
||||
template <typename T>
|
||||
T* enqueCommand()
|
||||
@ -33,5 +34,6 @@ protected:
|
||||
serial_u _dtuSerial;
|
||||
std::queue<std::shared_ptr<CommandAbstract>> _commandQueue;
|
||||
bool _isInitialized = false;
|
||||
bool _isConfigured = 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
|
||||
|
||||
if (_radio->isChipConnected()) {
|
||||
Hoymiles.getMessageOutput()->println("Connection successful");
|
||||
} else {
|
||||
Hoymiles.getMessageOutput()->println("Connection error!!");
|
||||
_isConfigured = true;
|
||||
if (!_radio->isChipConnected()) {
|
||||
Hoymiles.getMessageOutput()->println("CMT: Connection error!!");
|
||||
return;
|
||||
}
|
||||
Hoymiles.getMessageOutput()->println("CMT: Connection successful");
|
||||
|
||||
if (pin_gpio2 >= 0) {
|
||||
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);
|
||||
_rxBuffer.push(f);
|
||||
} else {
|
||||
Hoymiles.getMessageOutput()->println("Buffer full");
|
||||
Hoymiles.getMessageOutput()->println("CMT: Buffer full");
|
||||
_radio->flush_rx();
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,11 +23,12 @@ void HoymilesRadio_NRF::init(SPIClass* initialisedSpiBus, uint8_t pinCE, uint8_t
|
||||
_radio->setAddressWidth(5);
|
||||
_radio->setRetries(0, 0);
|
||||
_radio->maskIRQ(true, true, false); // enable only receiving interrupts
|
||||
if (_radio->isChipConnected()) {
|
||||
Hoymiles.getMessageOutput()->println("Connection successful");
|
||||
} else {
|
||||
Hoymiles.getMessageOutput()->println("Connection error!!");
|
||||
_isConfigured = true;
|
||||
if (!_radio->isChipConnected()) {
|
||||
Hoymiles.getMessageOutput()->println("NRF: Connection error!!");
|
||||
return;
|
||||
}
|
||||
Hoymiles.getMessageOutput()->println("NRF: Connection successful");
|
||||
|
||||
attachInterrupt(digitalPinToInterrupt(pinIRQ), std::bind(&HoymilesRadio_NRF::handleIntr, this), FALLING);
|
||||
|
||||
@ -60,7 +61,7 @@ void HoymilesRadio_NRF::loop()
|
||||
_radio->read(f.fragment, f.len);
|
||||
_rxBuffer.push(f);
|
||||
} else {
|
||||
Hoymiles.getMessageOutput()->println("Buffer full");
|
||||
Hoymiles.getMessageOutput()->println("NRF: Buffer full");
|
||||
_radio->flush_rx();
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ build_unflags =
|
||||
|
||||
lib_deps =
|
||||
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
|
||||
nrf24/RF24 @ ^1.4.5
|
||||
olikraus/U8g2 @ ^2.34.17
|
||||
|
||||
@ -30,22 +30,27 @@ void WebApiDevInfoClass::onDevInfoStatus(AsyncWebServerRequest* request)
|
||||
AsyncJsonResponse* response = new AsyncJsonResponse();
|
||||
JsonObject root = response->getRoot();
|
||||
|
||||
for (uint8_t i = 0; i < Hoymiles.getNumInverters(); i++) {
|
||||
auto inv = Hoymiles.getInverterByPos(i);
|
||||
uint64_t serial = 0;
|
||||
if (request->hasParam("inv")) {
|
||||
String s = request->getParam("inv")->value();
|
||||
serial = strtoll(s.c_str(), NULL, 16);
|
||||
}
|
||||
|
||||
JsonObject devInfoObj = root[inv->serialString()].createNestedObject();
|
||||
devInfoObj["valid_data"] = inv->DevInfo()->getLastUpdate() > 0;
|
||||
devInfoObj["fw_bootloader_version"] = inv->DevInfo()->getFwBootloaderVersion();
|
||||
devInfoObj["fw_build_version"] = inv->DevInfo()->getFwBuildVersion();
|
||||
devInfoObj["hw_part_number"] = inv->DevInfo()->getHwPartNumber();
|
||||
devInfoObj["hw_version"] = inv->DevInfo()->getHwVersion();
|
||||
devInfoObj["hw_model_name"] = inv->DevInfo()->getHwModelName();
|
||||
devInfoObj["max_power"] = inv->DevInfo()->getMaxPower();
|
||||
auto inv = Hoymiles.getInverterBySerial(serial);
|
||||
|
||||
if (inv != nullptr) {
|
||||
root["valid_data"] = inv->DevInfo()->getLastUpdate() > 0;
|
||||
root["fw_bootloader_version"] = inv->DevInfo()->getFwBootloaderVersion();
|
||||
root["fw_build_version"] = inv->DevInfo()->getFwBuildVersion();
|
||||
root["hw_part_number"] = inv->DevInfo()->getHwPartNumber();
|
||||
root["hw_version"] = inv->DevInfo()->getHwVersion();
|
||||
root["hw_model_name"] = inv->DevInfo()->getHwModelName();
|
||||
root["max_power"] = inv->DevInfo()->getMaxPower();
|
||||
|
||||
char timebuffer[32];
|
||||
const time_t t = inv->DevInfo()->getFwBuildDateTime();
|
||||
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();
|
||||
|
||||
@ -69,11 +69,11 @@ void WebApiSysstatusClass::onSystemStatus(AsyncWebServerRequest* request)
|
||||
|
||||
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_pvariant"] = Hoymiles.getRadioNrf()->isPVariant();
|
||||
|
||||
root["cmt_configured"] = Hoymiles.getRadioCmt()->isInitialized();
|
||||
root["cmt_configured"] = Hoymiles.getRadioCmt()->isConfigured();
|
||||
root["cmt_connected"] = Hoymiles.getRadioCmt()->isConnected();
|
||||
|
||||
response->setLength();
|
||||
|
||||
@ -557,10 +557,10 @@ export default defineComponent({
|
||||
},
|
||||
onShowDevInfo(serial: number) {
|
||||
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((data) => {
|
||||
this.devInfoList = data[serial][0];
|
||||
this.devInfoList = data;
|
||||
this.devInfoList.serial = serial;
|
||||
this.devInfoLoading = false;
|
||||
});
|
||||
|
||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user