The "OLED__Print" routine takes a long time and "hw_timer" does not interrupt it as described in the manual, so my PWM dimmer in "Set_Dim_handler" failed to second by second. There is some way to solve this. Thank you.
hw_timer_set_func(Set_Dim_handler);
hw_timer_init(NMI_SOURCE, 1);
hw_timer_arm(2000);
os_timer_disarm(&ntp_timer);
os_timer_setfn(&ntp_timer,ntp_time_update,NULL);
os_timer_arm(&ntp_timer,1000,1);
;********************************************************
void Set_Dim_handler(void) {
Put_OUTPUT(Canal_1_Pin,1);
os_delay_us(15);
Put_OUTPUT(Canal_1_Pin,0);
Corrent_T = Pwm_Luz[1].T1;
RTC_REG_WRITE(FRC1_LOAD_ADDRESS, Corrent_T);
}
void ICACHE_FLASH_ATTR ntp_time_update(void *ignored){
sntp_time++;
os_sprintf(TFT_Data , "%02d:%02d.%02d",_hour,_min,_sec);
OLED__Print(13, 0, TFT_Data,1);
}Statistics: Posted by Aires — Wed Feb 07, 2018 8:34 pm
]]>