| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- /*
- * RouterSetup.h
- *
- * Created on: 25.01.2022
- * Author: FSmilari
- */
-
- #ifndef ROUTER_SETUP_H_
- #define ROUTER_SETUP_H_
-
- #include <stdint.h>
- #include <Preferences.h>
- #include <RotaryEncoder.h>
- #include "Display.h"
- #include <stdio.h>
-
- const static char ROUTER_NAMESPACE[] = "routerelv_stp";
- const static char SPEED[] = "speed";
- const static char ACCELERATION[] = "acceleration";
- const static char STEPSPERREV[] = "stepsPerRev";
- const static char PITCH[] = "pitch";
- const static char TOOLLENGHTSNHT[] = "toolLenghtSnHt";
- const static char ENCSPEEDSLOW[] = "encSpeedSlow";
- const static char ENCSPEEDFAST[] = "encSpeedFast";
- const static char LVLHEIGHTDIVE[] = "lvlHeightDive";
- const static char TOOLCHGONPWRON[] = "toolChgOnPwrOn";
-
- const static String ConfigStep[9] = { "Geschw.", "Beschl.", "Schritte/U", "Steigung", "Höhe WLS", "SLOW", "FAST", "Ink. Eint.", "WzW P-ON" };
- const static int StepsPerRevOptsSize = 5;
- const static uint16_t StepsPerRevolutionOptions[StepsPerRevOptsSize] = { 200, 400, 800, 1600, 3200 };
-
- class RouterSetup {
- private:
- Preferences eeprom;
- Display &display;
- float speed; // in revolutions/second (U/s)
- float accelleration; // in revolutions/second^2 (U/s^2)
- uint16_t stepsPerRev; // micro stepping: 200 400 800 1600 3200 6400
- float pitch; // in mm
- float toolLenghtSensorHeight; // in mm
- uint8_t encoderSpeedSlow; // in 1/100 mm
- uint8_t encoderSpeedFast; // in 1/100 mm
- float levelHeightDiving; // in mm
- bool toolChangeOnPowerOn; // Yes or No
-
- bool doInitialization;
- byte configStepIndex;
- String getCfgOptForStepIndex(byte configStepIndex);
- String getCfgOptUnitForStepIndex(byte configStepIndex);
- int getIndexOfStepsPerRevValue(uint16_t value);
-
- public:
- const static int eeprom_start_adress = 0;
- const static int eeprom_signatur = 1024;
- const static uint8_t version = 1;
-
- RouterSetup(Display &display);
- float getSpeed() const;
- void setSpeed(float speed);
- float getAcceleration() const;
- void setAcceleration(float accelleration);
- uint8_t getEncoderSpeedFast() const;
- void setEncoderSpeedFast(uint8_t encoderSpeedFast);
- uint8_t getEncoderSpeedSlow() const;
- void setEncoderSpeedSlow(uint8_t encoderSpeedSlow);
- float getLevelHeightDiving() const;
- void setLevelHeightDiving(float levelHeightDiving);
- float getPitch() const;
- void setPitch(float pitch);
- uint16_t getStepsPerRev() const;
- void setStepsPerRev(uint16_t stepsPerRev);
- float getToolLenghtSensorHeight() const;
- void setToolLenghtSensorHeight(float toolLenghtSensorHeight);
- bool isToolChangOnPowerOn() const;
- void setToolChangOnPowerOn(bool toolChangOnPowerOn);
-
- void clear();
- void readFromEEPROM();
- void saveToEEPROM();
-
- void initialize();
- void onRotaryControlerSwitch();
- void onRotaryControlerLongSwitch();
- void onRotaryControlerTurn(RotaryEncoder::Direction turn);
- void save();
- void cancel();
-
- void printValues();
-
- };
-
-
- #endif /* ROUTER_SETUP_H_ */
|