writeDisplay als eigene Funktion ausgelagert
This commit is contained in:
parent
ae78a24959
commit
d07f251b04
|
@ -116,17 +116,11 @@ pinMode(MISO, INPUT);
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
unsigned long currentMillis = millis();
|
unsigned long currentMillis = millis();
|
||||||
|
|
||||||
UP = digitalRead(SCK);
|
UP = digitalRead(SCK);
|
||||||
DOWN = digitalRead(MOSI);
|
DOWN = digitalRead(MOSI);
|
||||||
ENTER = digitalRead(MISO);
|
ENTER = digitalRead(MISO);
|
||||||
display.setTextSize(2);
|
if (MotorDelay != MotorDelayOld){
|
||||||
display.setTextColor(SSD1306_WHITE); // Draw white text
|
writeDisplay();
|
||||||
display.setCursor(0,0); // Start at top-left corner
|
|
||||||
if (MotorDelay != MotorDelayOld){
|
|
||||||
display.clearDisplay();
|
|
||||||
display.println(F("Delay: ")); display.println(MotorDelay); display.println(MotorDelayEEPROM);
|
|
||||||
display.display();
|
|
||||||
MotorDelayOld = MotorDelay;
|
MotorDelayOld = MotorDelay;
|
||||||
}
|
}
|
||||||
if(UP == 1 && UP != UP_OLD){
|
if(UP == 1 && UP != UP_OLD){
|
||||||
|
@ -141,10 +135,8 @@ void loop() {
|
||||||
previousMillis = currentMillis;
|
previousMillis = currentMillis;
|
||||||
EEPROM.write(0, MotorDelay);
|
EEPROM.write(0, MotorDelay);
|
||||||
MotorDelayEEPROM = EEPROM.read(0);
|
MotorDelayEEPROM = EEPROM.read(0);
|
||||||
display.clearDisplay();
|
writeDisplay();
|
||||||
display.println(F("Delay: ")); display.println(MotorDelay); display.println(MotorDelayEEPROM);
|
MotorDelayOld = MotorDelay;
|
||||||
display.display();
|
|
||||||
MotorDelayOld = MotorDelay;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -164,3 +156,12 @@ void testdrawbitmap(void) {
|
||||||
logo_bmp, LOGO_WIDTH, LOGO_HEIGHT, 1);
|
logo_bmp, LOGO_WIDTH, LOGO_HEIGHT, 1);
|
||||||
display.display();
|
display.display();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void writeDisplay(void) {
|
||||||
|
display.setTextSize(2);
|
||||||
|
display.setTextColor(SSD1306_WHITE); // Draw white text
|
||||||
|
display.setCursor(0,0); // Start at top-left corner
|
||||||
|
display.clearDisplay();
|
||||||
|
display.println(F("Delay: ")); display.println(MotorDelay); display.println(F("EEPROM: ")); display.println(MotorDelayEEPROM);
|
||||||
|
display.display();
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue