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.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. void writeFloatToEEPROM(uint16_t addr, float value);
  33. float readFloatFromEEPROM(uint16_t addr);
  34. void writeIntegerToEEPROM(uint16_t addr, int value);
  35. int readIntegerFromEEPROM(uint16_t addr);
  36. public:
  37. // int eeprom_start_adress = 0;
  38. const static int eeprom_signatur = 1024;
  39. const static uint8_t version = 1;
  40. EchoLotSetup(Display &display);
  41. void initialize();
  42. void onRotaryControlerSwitch();
  43. void onRotaryControlerLongSwitch();
  44. void onRotaryControlerTurn(RotaryEncoder::Direction turn);
  45. void save();
  46. void cancel();
  47. void clear();
  48. void readFromEEPROM();
  49. void saveToEEPROM();
  50. void printValues();
  51. float getAirTemp() const;
  52. void setAirTemp(float airTemp);
  53. float getWaterTemp() const;
  54. void setWaterTemp(float waterTemp);
  55. float getSonicSpeedAir() const;
  56. void setSonicSpeedAir(float sonicSpeedAir);
  57. int getSaltPromilleWater() const;
  58. void setSaltPromilleWater(int saltPromilleWater);
  59. };
  60. #endif /* ROUTER_SETUP_H_ */