Move strings from RAM to Flash
This commit is contained in:
parent
226a57b328
commit
bab5beb170
@ -24,7 +24,7 @@ void HoymilesClass::loop()
|
|||||||
|
|
||||||
std::shared_ptr<InverterAbstract> iv = getInverterByPos(inverterPos);
|
std::shared_ptr<InverterAbstract> iv = getInverterByPos(inverterPos);
|
||||||
if (iv != nullptr && _radio->isIdle()) {
|
if (iv != nullptr && _radio->isIdle()) {
|
||||||
Serial.print("Fetch inverter: ");
|
Serial.print(F("Fetch inverter: "));
|
||||||
Serial.println(iv->serial());
|
Serial.println(iv->serial());
|
||||||
|
|
||||||
iv->clearRxFragmentBuffer();
|
iv->clearRxFragmentBuffer();
|
||||||
@ -34,7 +34,7 @@ void HoymilesClass::loop()
|
|||||||
if (now > 0) {
|
if (now > 0) {
|
||||||
_radio->sendTimePacket(iv, now);
|
_radio->sendTimePacket(iv, now);
|
||||||
} else {
|
} else {
|
||||||
Serial.println("Cancled. Time not yet synced.");
|
Serial.println(F("Cancled. Time not yet synced."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -80,22 +80,22 @@ void HoymilesRadio::loop()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_busyFlag && _rxTimeout.occured()) {
|
if (_busyFlag && _rxTimeout.occured()) {
|
||||||
Serial.println("Timeout");
|
Serial.println(F("RX Period End"));
|
||||||
std::shared_ptr<InverterAbstract> inv = Hoymiles.getInverterBySerial(_activeSerial.u64);
|
std::shared_ptr<InverterAbstract> inv = Hoymiles.getInverterBySerial(_activeSerial.u64);
|
||||||
|
|
||||||
if (nullptr != inv) {
|
if (nullptr != inv) {
|
||||||
uint8_t verifyResult = inv->verifyAllFragments();
|
uint8_t verifyResult = inv->verifyAllFragments();
|
||||||
if (verifyResult == 255) {
|
if (verifyResult == 255) {
|
||||||
Serial.println("Should Retransmit whole thing");
|
Serial.println(F("Should Retransmit whole thing"));
|
||||||
// todo: irgendwas tun wenn garnichts ankam....
|
// todo: irgendwas tun wenn garnichts ankam....
|
||||||
_busyFlag = false;
|
_busyFlag = false;
|
||||||
|
|
||||||
} else if (verifyResult == 254) {
|
} else if (verifyResult == 254) {
|
||||||
Serial.println("Retransmit timeout");
|
Serial.println(F("Retransmit timeout"));
|
||||||
_busyFlag = false;
|
_busyFlag = false;
|
||||||
|
|
||||||
} else if (verifyResult == 253) {
|
} else if (verifyResult == 253) {
|
||||||
Serial.println("Packet CRC error");
|
Serial.println(F("Packet CRC error"));
|
||||||
_busyFlag = false;
|
_busyFlag = false;
|
||||||
|
|
||||||
} else if (verifyResult > 0) {
|
} else if (verifyResult > 0) {
|
||||||
@ -106,6 +106,7 @@ void HoymilesRadio::loop()
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Successfull received all packages
|
// Successfull received all packages
|
||||||
|
Serial.println(F("Success"));
|
||||||
_busyFlag = false;
|
_busyFlag = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -227,7 +228,7 @@ void HoymilesRadio::sendEsbPacket(serial_u target, uint8_t mainCmd, uint8_t subC
|
|||||||
openWritingPipe(target);
|
openWritingPipe(target);
|
||||||
_radio->setRetries(3, 15);
|
_radio->setRetries(3, 15);
|
||||||
|
|
||||||
dumpBuf(NULL, txBuffer, 10 + len + 1);
|
dumpBuf("TX ", txBuffer, 10 + len + 1);
|
||||||
_radio->write(txBuffer, 10 + len + 1);
|
_radio->write(txBuffer, 10 + len + 1);
|
||||||
|
|
||||||
_radio->setRetries(0, 0);
|
_radio->setRetries(0, 0);
|
||||||
@ -255,7 +256,7 @@ void HoymilesRadio::sendTimePacket(std::shared_ptr<InverterAbstract> iv, time_t
|
|||||||
s.u64 = iv->serial();
|
s.u64 = iv->serial();
|
||||||
_activeSerial.u64 = iv->serial();
|
_activeSerial.u64 = iv->serial();
|
||||||
|
|
||||||
sendEsbPacket(s, 0x15, 0x80, payload, 16, 60);
|
sendEsbPacket(s, 0x15, 0x80, payload, sizeof(payload) / sizeof(uint8_t), 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HoymilesRadio::sendRetransmitPacket(uint8_t fragment_id)
|
void HoymilesRadio::sendRetransmitPacket(uint8_t fragment_id)
|
||||||
@ -286,5 +287,5 @@ void HoymilesRadio::dumpBuf(const char* info, uint8_t buf[], uint8_t len)
|
|||||||
Serial.print(buf[i], 16);
|
Serial.print(buf[i], 16);
|
||||||
Serial.print(" ");
|
Serial.print(" ");
|
||||||
}
|
}
|
||||||
Serial.println("");
|
Serial.println(F(""));
|
||||||
}
|
}
|
||||||
@ -42,7 +42,7 @@ void MqttSettingsClass::onMqttDisconnect(AsyncMqttClientDisconnectReason reason)
|
|||||||
void MqttSettingsClass::performConnect()
|
void MqttSettingsClass::performConnect()
|
||||||
{
|
{
|
||||||
if (WiFi.isConnected() && Configuration.get().Mqtt_Enabled) {
|
if (WiFi.isConnected() && Configuration.get().Mqtt_Enabled) {
|
||||||
Serial.println("Connecting to MQTT...");
|
Serial.println(F("Connecting to MQTT..."));
|
||||||
CONFIG_T& config = Configuration.get();
|
CONFIG_T& config = Configuration.get();
|
||||||
mqttClient.setServer(config.Mqtt_Hostname, config.Mqtt_Port);
|
mqttClient.setServer(config.Mqtt_Hostname, config.Mqtt_Port);
|
||||||
mqttClient.setCredentials(config.Mqtt_Username, config.Mqtt_Password);
|
mqttClient.setCredentials(config.Mqtt_Username, config.Mqtt_Password);
|
||||||
|
|||||||
@ -113,7 +113,7 @@ void WiFiSettingsClass::applyConfig()
|
|||||||
Serial.print(F("existing credentials... "));
|
Serial.print(F("existing credentials... "));
|
||||||
WiFi.begin();
|
WiFi.begin();
|
||||||
}
|
}
|
||||||
Serial.println("done");
|
Serial.println(F("done"));
|
||||||
setStaticIp();
|
setStaticIp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user