zcd
This commit is contained in:
parent
b187b66ed6
commit
d3b5b0614d
|
|
@ -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");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
Config.h
10
Config.h
|
|
@ -65,6 +65,16 @@ enum TEMP_SENSOR_TYPE {
|
||||||
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 */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
7
zcd.cpp
7
zcd.cpp
|
|
@ -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() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user