| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- /*
- * 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[5] = { "Temp. Luft", "Temp. Wasser", "Vsonic 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);
-
- 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:
- // int eeprom_start_adress = 0;
- const static int eeprom_signatur = 1024;
- const static uint8_t version = 1;
-
- EchoLotSetup(Display &display);
- void initialize();
- 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_ */
|