From: Nathael Pajani Date: Sat, 1 Dec 2018 13:18:45 +0000 (+0100) Subject: Fix over-heating protectioin for beta version of scialys module X-Git-Url: http://git.techno-innov.fr/?a=commitdiff_plain;h=c864d62cd1f4e38ee0deb74ffc3a0413d3299299;p=soft%2Flpc122x%2Fscialys Fix over-heating protectioin for beta version of scialys module --- diff --git a/beta/main.c b/beta/main.c index 3619810..9b5800d 100644 --- a/beta/main.c +++ b/beta/main.c @@ -67,8 +67,9 @@ * When in forced heater mode, the heater is controlled to heat at FORCED_MODE_VALUE which * is between 0 and 100. */ -#define FORCE_HEATER_TEMP 28 -#define TARGET_FORCED_HEATER_TEMP 32 +#define FORCE_HEATER_TEMP 35 +#define MAX_HEATER_TEMP 90 +#define TARGET_FORCED_HEATER_TEMP 50 #define FORCED_MODE_VALUE 75 /* A fraction of 100 */ /* mA prod value above which the system will not enter forced mode, waiting for home * to stop using power to start automatic heating */ @@ -218,11 +219,11 @@ struct rtc_pcf85363a_config rtc_conf = { }; /* Oldest acceptable time in RTC. BCD coded. */ const struct rtc_time oldest = { - .year = 0x16, - .month = 0x12, - .day = 0x01, - .hour = 0x13, - .min = 0x37, + .year = 0x18, + .month = 0x09, + .day = 0x08, + .hour = 0x18, + .min = 0x00, }; static struct rtc_time now; @@ -360,18 +361,6 @@ void zero_cross(uint32_t gpio) ac_ctrl_state = 1; } -static uint8_t thermal_warn_flag = 0; -void th_warning(uint32_t gpio) -{ - /* FIXME : test for condition set or removed */ - /* Turn off AC output */ - gpio_clear(ac_ctrl); - act_cmd = 0; - thermal_warn_flag = 1; - /* Turn on Fan at max speed */ - timer_set_match(LPC_TIMER_32B0, CHAN0, 0); -} - /***************************************************************************** */ @@ -531,7 +520,6 @@ int main(void) /* Zero cross and alert pin */ set_gpio_callback(zero_cross, &zero_cross_in_pin, EDGE_FALLING); - set_gpio_callback(th_warning, &th_warn_in_pin, EDGES_BOTH); /* Start ADC sampling */ adc_start_burst_conversion(ADC_MCH(0) | ADC_MCH(1) | ADC_MCH(2) | ADC_MCH(7), LPC_ADC_SEQ(0)); @@ -769,6 +757,10 @@ int main(void) } /* Set Control Output duty cycle */ + if (water_centi_degrees > (MAX_HEATER_TEMP * 100)) { + command_val = 0; + } + set_ctrl_duty_cycle(command_val); /* Debug Nath TMP */ //set_ctrl_duty_cycle( user_potar / 10 );