|
@ -11,6 +11,8 @@ using namespace iflytop; |
|
|
#define ACTION_TEST_PUMP_SET_LEVEL 2
|
|
|
#define ACTION_TEST_PUMP_SET_LEVEL 2
|
|
|
#define ACTION_TEST_FAN_SET_LEVEL 3
|
|
|
#define ACTION_TEST_FAN_SET_LEVEL 3
|
|
|
#define ACTION_TEST_DUMP_DC_MOTOR_STATE 4
|
|
|
#define ACTION_TEST_DUMP_DC_MOTOR_STATE 4
|
|
|
|
|
|
#define ACTION_TEST_ENABLE_LOG 5
|
|
|
|
|
|
#define ACTION_TEST_DISABLE_LOG 6
|
|
|
|
|
|
|
|
|
void WaterCoolingTemperatureControlModule::initialize(int32_t id, config_t* cfg, hardwared_config_t* hardwaredconfig) { |
|
|
void WaterCoolingTemperatureControlModule::initialize(int32_t id, config_t* cfg, hardwared_config_t* hardwaredconfig) { |
|
|
m_id = id; |
|
|
m_id = id; |
|
@ -103,6 +105,12 @@ int32_t WaterCoolingTemperatureControlModule::do_action(int32_t actioncode) { |
|
|
} else if (actioncode == ACTION_TEST_DUMP_DC_MOTOR_STATE) { |
|
|
} else if (actioncode == ACTION_TEST_DUMP_DC_MOTOR_STATE) { |
|
|
m_pelter_ctrl->dumpErrorInfo(); |
|
|
m_pelter_ctrl->dumpErrorInfo(); |
|
|
return 0; |
|
|
return 0; |
|
|
|
|
|
} else if (actioncode == ACTION_TEST_ENABLE_LOG) { |
|
|
|
|
|
m_enable_log = 1; |
|
|
|
|
|
return 0; |
|
|
|
|
|
} else if (actioncode == ACTION_TEST_DISABLE_LOG) { |
|
|
|
|
|
m_enable_log = 0; |
|
|
|
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
else { |
|
|
else { |
|
@ -155,7 +163,10 @@ void WaterCoolingTemperatureControlModule::workloop() { |
|
|
float out = 0; |
|
|
float out = 0; |
|
|
m_pidmodule.compute(error, &out); |
|
|
m_pidmodule.compute(error, &out); |
|
|
|
|
|
|
|
|
ZLOGI(TAG, "temperature: %.2f %.2f integral_err:%.2f out:%d", m_target_temperature, val, m_pidmodule.get_integral_err(), (int32_t)out); |
|
|
|
|
|
|
|
|
if (m_enable_log) { |
|
|
|
|
|
ZLOGI(TAG, "temperature: %.2f %.2f integral_err:%.2f out:%d", m_target_temperature, val, m_pidmodule.get_integral_err(), (int32_t)out); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
peltier_set_power_level(out); |
|
|
peltier_set_power_level(out); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|