Distanz-/Tiefenmesser mit JSN-SR40T
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * RouterSetup.h
  3. *
  4. * Created on: 05.01.2026
  5. * Author: FSmilari
  6. */
  7. #ifndef ECHOLOT_SETUP_H_
  8. #define ECHOLOT_SETUP_H_
  9. #include <stdint.h>
  10. #include <stdio.h>
  11. #include <RotaryEncoder.h>
  12. #include <EEPROM.h>
  13. #include "Display.h"
  14. const static char ECHOLOT_NAMESPACE[] = "echolot_stp";
  15. const static char AIRTEMP[] = "airTemp";
  16. const static char WATERTEMP[] = "waterTemp";
  17. const static char SONICSPEEDAIR[] = "sonicSpeedAir";
  18. const static char SALTPROMILLEWATER[] = "saltPromilleWater";
  19. const static String ConfigStep[4] = { "Temp. Luft", "Temp. Wasser", "Vsnc Luft", "Salzgeh. Wasser" };
  20. #define eeprom_start_adress 0
  21. class EchoLotSetup {
  22. private:
  23. Display &display;
  24. float airTemp; // in °C
  25. float waterTemp; // in °C
  26. float sonicSpeedAir; // im m/s
  27. int saltPromilleWater;
  28. bool doInitialization;
  29. byte configStepIndex;
  30. String getCfgOptForStepIndex(byte configStepIndex);
  31. String getCfgOptUnitForStepIndex(byte configStepIndex);
  32. String getCfgValueForStepIndex(byte configStepIndex);
  33. void writeFloatToEEPROM(uint16_t addr, float value);
  34. float readFloatFromEEPROM(uint16_t addr);
  35. void writeIntegerToEEPROM(uint16_t addr, int value);
  36. int readIntegerFromEEPROM(uint16_t addr);
  37. public:
  38. EchoLotSetup(Display &display);
  39. void initialize();
  40. void drawInitScreen();
  41. void onRotaryControlerSwitch();
  42. void onRotaryControlerLongSwitch();
  43. void onRotaryControlerTurn(RotaryEncoder::Direction turn);
  44. void save();
  45. void cancel();
  46. void clear();
  47. void readFromEEPROM();
  48. void saveToEEPROM();
  49. void printValues();
  50. float getAirTemp() const;
  51. void setAirTemp(float airTemp);
  52. float getWaterTemp() const;
  53. void setWaterTemp(float waterTemp);
  54. float getSonicSpeedAir() const;
  55. void setSonicSpeedAir(float sonicSpeedAir);
  56. int getSaltPromilleWater() const;
  57. void setSaltPromilleWater(int saltPromilleWater);
  58. };
  59. #endif /* ROUTER_SETUP_H_ */