More EEPROM cleanup
This commit is contained in:
parent
7a0ff89c28
commit
67c768810b
|
@ -843,15 +843,17 @@ void setup() {
|
||||||
Serial.printf("EEPROM 0: %d\n", EEPROM.read(0));
|
Serial.printf("EEPROM 0: %d\n", EEPROM.read(0));
|
||||||
Serial.printf("EEPROM 1: %d\n", EEPROM.read(1));
|
Serial.printf("EEPROM 1: %d\n", EEPROM.read(1));
|
||||||
Serial.printf("EEPROM 2: %d\n", EEPROM.read(2));
|
Serial.printf("EEPROM 2: %d\n", EEPROM.read(2));
|
||||||
if(EEPROM.read(0) <= 3){
|
if(EEPROM.read(0) > 3){
|
||||||
rotation = EEPROM.read(0);
|
// Let's just assume rotation > 3 is a fresh/corrupt EEPROM and write defaults for everything
|
||||||
} else {
|
Serial.println("EEPROM likely not properly configured. Writing defaults.");
|
||||||
rotation = 3;
|
EEPROM.write(0, 3); // Left rotation
|
||||||
EEPROM.write(0, rotation);
|
EEPROM.write(1, 15); // 15 second auto dim time
|
||||||
|
EEPROM.write(2, 100); // 100% brightness
|
||||||
EEPROM.commit();
|
EEPROM.commit();
|
||||||
}
|
}
|
||||||
screen_dim_time = EEPROM.read(1) % 30;
|
rotation = EEPROM.read(0);
|
||||||
brightness = EEPROM.read(2) % 100;
|
screen_dim_time = EEPROM.read(1);
|
||||||
|
brightness = EEPROM.read(2);
|
||||||
M5.Axp.ScreenBreath(brightness);
|
M5.Axp.ScreenBreath(brightness);
|
||||||
M5.Lcd.setRotation(rotation);
|
M5.Lcd.setRotation(rotation);
|
||||||
M5.Lcd.setTextColor(GREEN, BLACK);
|
M5.Lcd.setTextColor(GREEN, BLACK);
|
||||||
|
|
Loading…
Reference in New Issue