NULL txt_freq fix

This commit is contained in:
Tester
2024-11-01 14:25:38 +01:00
parent 62d405cb1e
commit 7cf4d0bef4
2 changed files with 4 additions and 3 deletions

View File

@ -83,8 +83,9 @@ void CControllerBL0942::saveTo(struct cJSON *j_obj) {
cJSON_AddStringToObject(j_obj, "voltage", this->txt_voltage->getText());
cJSON_AddStringToObject(j_obj, "current", this->txt_current->getText());
cJSON_AddStringToObject(j_obj, "power", this->txt_power->getText());
cJSON_AddStringToObject(j_obj, "frequency", this->txt_freq->getText());
if (this->txt_freq) {
cJSON_AddStringToObject(j_obj, "frequency", this->txt_freq->getText());
}
}
void CControllerBL0942::loadFrom(struct cJSON *j_obj) {
cJSON *v = cJSON_GetObjectItemCaseSensitive(j_obj, "voltage");

View File

@ -18,7 +18,7 @@ class CControllerBL0942 : public CControllerBase {
public:
CControllerBL0942() {
rx = tx = 0;
txt_voltage = txt_current = txt_power = 0;
txt_voltage = txt_current = txt_power = txt_freq = 0;
realCurrent = 0.25f;
realPower = 60.0f;
realVoltage = 220.0f;