This commit is contained in:
Heuideog Yi @ PC RnD1 2026-05-01 21:59:15 +09:00
parent b187b66ed6
commit d3b5b0614d
4 changed files with 22 additions and 10 deletions

View File

@ -184,5 +184,5 @@ void CONFIG_TYPE::save() {
preferences.putBytes("config_data", &config, sizeof(config)); preferences.putBytes("config_data", &config, sizeof(config));
preferences.end(); // Close preferences preferences.end(); // Close preferences
bConfigSaved = true; bConfigSaved = true;
ESP_LOGI(TAG,"Config Saved"); DPRINTLN("[Config] Saved");
} }

View File

@ -63,7 +63,17 @@ enum TEMP_SENSOR_TYPE {
BLE_TUYA, BLE_TUYA,
BLE_XIAOMI_MIJIA, BLE_XIAOMI_MIJIA,
BLE_INKBIRD BLE_INKBIRD
}; };
enum ENUM_DEVICE_PARAM_TYPE {
DEVICE_PARAM_TYPE_AC1,
DEVICE_PARAM_TYPE_AC2,
DEVICE_PARAM_TYPE_MIST,
DEVICE_PARAM_TYPE_FAN,
DEVICE_PARAM_TYPE_MOTOR,
DEVICE_PARAM_TYPE_LIGHT,
DEVICE_PARAM_TYPE_COUNT
};
#pragma pack(push) /* push current alignment to stack */ #pragma pack(push) /* push current alignment to stack */
#pragma pack(1) /* set alignment to 1 byte boundary */ #pragma pack(1) /* set alignment to 1 byte boundary */

View File

@ -585,7 +585,9 @@ L_CMD_SEND_CONFIG:
return; return;
L_CMD_SET_DEVICE_PARAM: L_CMD_SET_DEVICE_PARAM:
if (pkt.op < ENUM_DEVICE_PARAM_TYPE::DEVICE_PARAM_TYPE_COUNT) {
config.deviceParamArray[pkt.op] = pkt.device; config.deviceParamArray[pkt.op] = pkt.device;
}
return; return;
L_CMD_GET_DEVICE_PARAM: L_CMD_GET_DEVICE_PARAM:
@ -838,14 +840,17 @@ MY_IRAM_ATTR bool CWiFiHost::ReceiveData(unsigned long clock)
if (m_bReceiveConfigPending && m_pDataReceive_data == (char *)&configCopy) { if (m_bReceiveConfigPending && m_pDataReceive_data == (char *)&configCopy) {
config = configCopy; config = configCopy;
history.loadPID(); history.loadPID();
DPRINTLN("[WiFi] Host - Config Received");
m_bReceiveConfigPending = false; m_bReceiveConfigPending = false;
if (m_bSaveReceivedConfig) { if (m_bSaveReceivedConfig) {
config.save(); config.save();
m_bSaveReceivedConfig = false; m_bSaveReceivedConfig = false;
DPRINTLN("[WiFi] Host - Config Received & saved");
} else {
DPRINTLN("[WiFi] Host - Config Received.");
} }
} }
DPRINTLN("[WIFI] Host - ReceiveData: Data Receive Completed!"); DPRINTF("[WIFI] Host - ReceiveData: Data Received %dbytes!\r\n",
m_nDataReceive_received);
return true; return true;
} }

View File

@ -214,7 +214,7 @@ void IRAM_ATTR zcdACISR(void *) {
timer_set_alarm_value(TIMER_GROUP_1, TIMER_0, (uint64_t) LEADING_ZCD_COUNT); timer_set_alarm_value(TIMER_GROUP_1, TIMER_0, (uint64_t) LEADING_ZCD_COUNT);
timer_set_alarm(TIMER_GROUP_1, TIMER_0, TIMER_ALARM_EN); timer_set_alarm(TIMER_GROUP_1, TIMER_0, TIMER_ALARM_EN);
} }
} else // PHASE_CONTROL } else // if (ac1ControlMode == PHASE_CONTROL)
if ( dutyHeater1 >= LEADING_PULSE_COUNT){ if ( dutyHeater1 >= LEADING_PULSE_COUNT){
timer_set_counter_value(TIMER_GROUP_1, TIMER_0, 0); timer_set_counter_value(TIMER_GROUP_1, TIMER_0, 0);
timer_set_alarm_value(TIMER_GROUP_1, TIMER_0, (uint64_t) dutyHeater1); timer_set_alarm_value(TIMER_GROUP_1, TIMER_0, (uint64_t) dutyHeater1);
@ -228,7 +228,7 @@ void IRAM_ATTR zcdACISR(void *) {
timer_set_alarm_value(TIMER_GROUP_1, TIMER_1, (uint64_t)LEADING_ZCD_COUNT); timer_set_alarm_value(TIMER_GROUP_1, TIMER_1, (uint64_t)LEADING_ZCD_COUNT);
timer_set_alarm(TIMER_GROUP_1, TIMER_1, TIMER_ALARM_EN); timer_set_alarm(TIMER_GROUP_1, TIMER_1, TIMER_ALARM_EN);
} }
} else // PHASE_CONTROL } else // if (ac2ControlMode == PHASE_CONTROL)
if (dutyHeater2 >= LEADING_PULSE_COUNT) { if (dutyHeater2 >= LEADING_PULSE_COUNT) {
timer_set_counter_value(TIMER_GROUP_1, TIMER_1, 0); timer_set_counter_value(TIMER_GROUP_1, TIMER_1, 0);
timer_set_alarm_value(TIMER_GROUP_1, TIMER_1, (uint64_t)dutyHeater2); timer_set_alarm_value(TIMER_GROUP_1, TIMER_1, (uint64_t)dutyHeater2);
@ -238,10 +238,7 @@ void IRAM_ATTR zcdACISR(void *) {
} }
void IRAM_ATTR zcdLoadISR(void *) { void IRAM_ATTR zcdLoadISR(void *) {
// Load side AC ZCD Count
#ifndef DEBUG_ZCD
zcdLoadISRCount = zcdLoadISRCount + 1; zcdLoadISRCount = zcdLoadISRCount + 1;
#endif
} }
void setupZCD() { void setupZCD() {