| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- /*
- * RouterSetup.h
- *
- * Created on: 05.01.2026
- * Author: FSmilari
- */
-
- #ifndef ECHOLOT_SETUP_H_
- #define ECHOLOT_SETUP_H_
-
- #include <stdint.h>
- #include <stdio.h>
- #include <RotaryEncoder.h>
- #include <EEPROM.h>
- #include "Display.h"
-
- const static char ECHOLOT_NAMESPACE[] = "echolot_stp";
- const static char AIRTEMP[] = "airTemp";
- const static char WATERTEMP[] = "waterTemp";
- const static char SONICSPEEDAIR[] = "sonicSpeedAir";
- const static char SALTPROMILLEWATER[] = "saltPromilleWater";
-
- const static String ConfigStep[4] = { "Temp. Luft", "Temp. Wasser", "Vsnc Luft", "Salzgeh. Wasser" };
-
- #define eeprom_start_adress 0
-
- class EchoLotSetup {
- private:
- Display &display;
- float airTemp; // in °C
- float waterTemp; // in °C
- float sonicSpeedAir; // im m/s
- int saltPromilleWater;
-
- bool doInitialization;
- byte configStepIndex;
- String getCfgOptForStepIndex(byte configStepIndex);
- String getCfgOptUnitForStepIndex(byte configStepIndex);
- String getCfgValueForStepIndex(byte configStepIndex);
-
- void writeFloatToEEPROM(uint16_t addr, float value);
- float readFloatFromEEPROM(uint16_t addr);
- void writeIntegerToEEPROM(uint16_t addr, int value);
- int readIntegerFromEEPROM(uint16_t addr);
-
- public:
- EchoLotSetup(Display &display);
- void initialize();
- void drawInitScreen();
- void onRotaryControlerSwitch();
- void onRotaryControlerLongSwitch();
- void onRotaryControlerTurn(RotaryEncoder::Direction turn);
- void save();
- void cancel();
-
- void clear();
- void readFromEEPROM();
- void saveToEEPROM();
-
- void printValues();
-
- float getAirTemp() const;
- void setAirTemp(float airTemp);
- float getWaterTemp() const;
- void setWaterTemp(float waterTemp);
- float getSonicSpeedAir() const;
- void setSonicSpeedAir(float sonicSpeedAir);
- int getSaltPromilleWater() const;
- void setSaltPromilleWater(int saltPromilleWater);
- };
-
- #endif /* ROUTER_SETUP_H_ */
|