Files
projekt-arduino/Display.cpp
T
GarandPLG 17f888a11c Rename Projekt.ino to Projekt_Arduino.ino
Rename Projekt.ino to Projekt_Arduino.ino

- Rename the main sketch file and adjust references accordingly.
- Clean up Config.h spacing and delete unused turn‑signal constants.
- Remove direction‑related LCD character data and its update logic.
- Introduce Display::startOrEnd to control LCD power on/off.
- Simplify display initialization and eliminate the old delay in the
  loop.
- Add serial debug output for the car enable state.
2026-06-16 22:32:39 +02:00

48 lines
911 B
C++

#include "Display.h"
void Display::begin(int cols, int rows) {
_lcd.begin(cols, rows);
_lcd.noDisplay();
_lcd.setCursor(0, 0);
_lcd.print("km/h: 000 | ");
_lcd.setCursor(0, 1);
_lcd.print("rpm: 0000 | G:0");
}
void Display::startOrEnd(bool enable) {
if (enable) {
delay(3000);
_lcd.display();
} else {
_lcd.noDisplay();
}
}
void Display::updateSpeed(int kmh) {
if (kmh < 0) kmh = 0;
if (kmh > 999) kmh = 999;
_lcd.setCursor(6, 0);
if (kmh < 100) _lcd.print('0');
if (kmh < 10) _lcd.print('0');
_lcd.print(kmh);
}
void Display::updateRPM(int rpm) {
if (rpm < 0) rpm = 0;
if (rpm > 9999) rpm = 9999;
_lcd.setCursor(5, 1);
if (rpm < 1000) _lcd.print('0');
if (rpm < 100) _lcd.print('0');
if (rpm < 10) _lcd.print('0');
_lcd.print(rpm);
}
void Display::updateGear(char gearChar) {
_lcd.setCursor(14, 1);
_lcd.print(gearChar);
_lcd.print(' ');
}