Properly turn off flame when it's day.
Also: skip everything if disabled. And: debugging display
This commit is contained in:
parent
942440ec0c
commit
999b3bd809
|
@ -61,8 +61,21 @@ void setFlamePWM() {
|
|||
flameSetI2C(FLAME_I2C_CR_PWM0, flameI2Cpwm); // set pwm
|
||||
}
|
||||
|
||||
|
||||
void tick_flame(void) { // every 10ms
|
||||
static char night=0;
|
||||
|
||||
if(!flameEnabled)
|
||||
return;
|
||||
|
||||
if(night!=isNight()){
|
||||
night=isNight();
|
||||
if(!night){
|
||||
flameMode = FLAME_OFF;
|
||||
flameI2Cpwm = 0;
|
||||
push_queue(&setFlamePWM);
|
||||
};
|
||||
};
|
||||
|
||||
flameTicks++;
|
||||
|
||||
if (flameI2Cpwm > flameBrightnessMax) {
|
||||
|
@ -135,3 +148,24 @@ void flameInit(void) {
|
|||
flameSetI2C(FLAME_I2C_CR_LS0, FLAME_I2C_LS0_PWM0 << FLAME_I2C_LS0_LED0); // set led0 to pwm
|
||||
}
|
||||
}
|
||||
|
||||
#include "lcd/print.h"
|
||||
|
||||
void ChkFlame(void) {
|
||||
do{
|
||||
lcdClear();
|
||||
lcdPrint("Enabled:");
|
||||
lcdPrintln(IntToStr(flameEnabled,1,0));
|
||||
|
||||
lcdPrint("State:");
|
||||
lcdPrintln(IntToStr(flameMode,1,0));
|
||||
|
||||
lcdPrint("PWMtarg:");
|
||||
lcdPrintln(IntToStr(flameI2Cpwm,3,0));
|
||||
|
||||
lcdPrint("FTicks:");
|
||||
lcdPrintln(IntToStr(flameTicks,3,0));
|
||||
|
||||
lcdRefresh();
|
||||
} while ((getInputRaw())==BTN_NONE);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue