Make backlight and lcd-state config vars actually work
This commit is contained in:
parent
477dfcf98a
commit
250ea3213f
|
@ -39,7 +39,7 @@ void tick_default(void) {
|
|||
};
|
||||
|
||||
if(isNight())
|
||||
backlightSetBrightness(100);
|
||||
backlightSetBrightness(globalconfig.backlightvalue);
|
||||
else
|
||||
backlightSetBrightness(0);
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "basic/basic.h"
|
||||
|
||||
#include "lcd/print.h"
|
||||
#include "lcd/display.h"
|
||||
|
||||
#include "filesystem/ff.h"
|
||||
|
||||
|
@ -33,5 +34,5 @@ void show(void){
|
|||
};
|
||||
|
||||
void lcdmirror(void){
|
||||
globalconfig.lcdstate^=2;
|
||||
lcdToggleFlag(LCD_MIRRORX);
|
||||
};
|
||||
|
|
|
@ -33,10 +33,11 @@ void adc_light(void) {
|
|||
int dx=0;
|
||||
int dy=8;
|
||||
dx=DoString(0,dy,"Light:");
|
||||
DoString(0,dy+8,"Night:");
|
||||
DoString(0,dy+16,"Night:");
|
||||
while ((getInputRaw())==BTN_NONE){
|
||||
DoInt(dx,dy,GetLight());
|
||||
DoInt(dx,dy+8,isNight());
|
||||
DoInt(dx,dy+16,isNight());
|
||||
DoInt(dx,dy+8,globalconfig.backlighttrigger);
|
||||
lcdDisplay();
|
||||
};
|
||||
dy+=8;
|
||||
|
|
|
@ -77,9 +77,5 @@ int readConfig(void){
|
|||
};
|
||||
|
||||
int applyConfig(){
|
||||
if(globalconfig.lcdstate & LCD_INVERTED)
|
||||
lcdToggleFlag(LCD_INVERTED);
|
||||
if(globalconfig.lcdstate & LCD_MIRRORX)
|
||||
lcdToggleFlag(LCD_MIRRORX);
|
||||
return 0;
|
||||
};
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
uint32_t light=300*HYST;
|
||||
char _isnight=1;
|
||||
|
||||
#define threshold globalconfig.backlighttrigger
|
||||
|
||||
void LightCheck(void){
|
||||
int iocon;
|
||||
char iodir;
|
||||
|
@ -25,16 +27,14 @@ void LightCheck(void){
|
|||
gpioSetDir(RB_LED3, iodir);
|
||||
IOCON_PIO1_11=iocon;
|
||||
|
||||
static uint16_t threshold=0;
|
||||
if(threshold==0){
|
||||
// read threshold from config
|
||||
threshold=320 * HYST;
|
||||
if(threshold==0){ // uninitialized?
|
||||
threshold=320;
|
||||
};
|
||||
|
||||
if(_isnight && light>(threshold+RANGE*HYST))
|
||||
if(_isnight && light/HYST>(threshold+RANGE))
|
||||
_isnight=0;
|
||||
|
||||
if(!_isnight && light<threshold)
|
||||
if(!_isnight && light/HYST<threshold)
|
||||
_isnight=1;
|
||||
};
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
/**************************************************************************/
|
||||
|
||||
uint8_t lcdBuffer[RESX*RESY_B];
|
||||
int lcd_layout = 0;
|
||||
#define lcd_layout globalconfig.lcdstate
|
||||
uint32_t intstatus; // Caches USB interrupt state
|
||||
// (need to disable MSC while displaying)
|
||||
|
||||
|
|
Loading…
Reference in New Issue