| @@ -25,9 +25,6 @@ | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/ezButton/src}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/RotaryEncoder}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/RotaryEncoder/src}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_GFX_Library}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_SSD1306}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_BusIO}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/SPI}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/SPI/src}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Wire}""/> | |||
| @@ -35,6 +32,10 @@ | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/FreeRTOS}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/STM32duino_RTC}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/ESP-FlexyStepper/src}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Preferences/src}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_SSD1306}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_GFX_Library}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_BusIO}""/> | |||
| </option> | |||
| <inputType id="io.sloeber.compiler.cpp.sketch.input.1777418047" name="CPP source files" superClass="io.sloeber.compiler.cpp.sketch.input"/> | |||
| </tool> | |||
| @@ -46,9 +47,6 @@ | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/ezButton/src}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/RotaryEncoder}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/RotaryEncoder/src}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_GFX_Library}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_SSD1306}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_BusIO}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/SPI}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/SPI/src}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Wire}""/> | |||
| @@ -56,6 +54,10 @@ | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/FreeRTOS}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/STM32duino_RTC}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/ESP-FlexyStepper/src}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Preferences/src}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_SSD1306}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_GFX_Library}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_BusIO}""/> | |||
| </option> | |||
| <inputType id="io.sloeber.compiler.c.sketch.input.1282698896" name="C Source Files" superClass="io.sloeber.compiler.c.sketch.input"/> | |||
| </tool> | |||
| @@ -67,9 +69,6 @@ | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/ezButton/src}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/RotaryEncoder}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/RotaryEncoder/src}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_GFX_Library}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_SSD1306}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_BusIO}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/SPI}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/SPI/src}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Wire}""/> | |||
| @@ -78,6 +77,10 @@ | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/STM32duino_RTC}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Simple_Repository_IO}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/ESP-FlexyStepper/src}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Preferences/src}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_SSD1306}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_GFX_Library}""/> | |||
| <listOptionValue builtIn="false" value=""${workspace_loc:/Fraestisch_SFTools/libraries/Adafruit_BusIO}""/> | |||
| </option> | |||
| <inputType id="io.sloeber.compiler.S.sketch.input.1238595277" name="Assembly source files" superClass="io.sloeber.compiler.S.sketch.input"/> | |||
| </tool> | |||
| @@ -66,6 +66,11 @@ | |||
| <type>2</type> | |||
| <locationURI>ECLIPSE_HOME/arduinoPlugin/libraries/FreeRTOS/10.4.6-0</locationURI> | |||
| </link> | |||
| <link> | |||
| <name>libraries/Preferences</name> | |||
| <type>2</type> | |||
| <locationURI>ECLIPSE_HOME/arduinoPlugin/packages/esp32/hardware/esp32/1.0.6/libraries/Preferences</locationURI> | |||
| </link> | |||
| <link> | |||
| <name>libraries/RotaryEncoder</name> | |||
| <type>2</type> | |||
| @@ -0,0 +1,88 @@ | |||
| /* | |||
| * Display.cpp | |||
| * | |||
| * Wrapper class for Adafruit OLED display. | |||
| * | |||
| * Created on: 28.01.2022 | |||
| * Author: FSmilari | |||
| */ | |||
| #include "Display.h" | |||
| /***************** | |||
| ** Constructors. | |||
| ****************/ | |||
| Display::Display() { | |||
| ssd1306 = Adafruit_SSD1306(SCREEN_WIDTH, SCREEN_HEIGHT); | |||
| } | |||
| /****************** | |||
| ** Public methods | |||
| *****************/ | |||
| void Display::init() { | |||
| if (!ssd1306.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS, true, true)) { | |||
| Serial.println(F("SSD1306 allocation failed")); | |||
| for (;;) | |||
| ; // Don't proceed, loop forever | |||
| } | |||
| } | |||
| void Display::display() { | |||
| ssd1306.display(); | |||
| } | |||
| void Display::clearDisplay() { | |||
| ssd1306.clearDisplay(); | |||
| } | |||
| void Display::showBrand() { | |||
| ssd1306.clearDisplay(); | |||
| ssd1306.drawBitmap(0, 0, epd_bitmap_SFTools_Logo, 128, 34, SSD1306_WHITE); | |||
| ssd1306.setFont(&titillium_web_semibold12pt7b); | |||
| ssd1306.setTextSize(1); | |||
| ssd1306.setTextColor(SSD1306_WHITE); | |||
| uint16_t w = 0, h = 0; | |||
| calculateWH("Fraestisch N172", w, h); | |||
| ssd1306.setCursor((SCREEN_WIDTH - w) / 2, 63 - (30 - h) / 2); | |||
| ssd1306.println("Fraestisch N172"); | |||
| display(); | |||
| } | |||
| void Display::showInitialization() { | |||
| ssd1306.clearDisplay(); | |||
| ssd1306.setFont(&titillium_web_semibold12pt7b); | |||
| ssd1306.setTextSize(1); | |||
| ssd1306.setTextColor(SSD1306_WHITE); | |||
| uint16_t w = 0, h = 0; | |||
| calculateWH("Initialisieren", w, h); | |||
| ssd1306.setCursor((SCREEN_WIDTH - w) / 2, 30); | |||
| ssd1306.println("Initialisieren"); | |||
| calculateWH(". . . . .", w, h); | |||
| ssd1306.setCursor((SCREEN_WIDTH - w) / 2, 50); | |||
| String s = ""; | |||
| for (int i = 0; i < 6; i++) { | |||
| ssd1306.print(s); | |||
| display(); | |||
| delay(500); | |||
| if (i < 5) { | |||
| ssd1306.print(s + ". "); | |||
| } else { | |||
| ssd1306.println(s + "."); | |||
| } | |||
| } | |||
| } | |||
| /******************************** | |||
| ** Private methods | |||
| *******************************/ | |||
| void Display::calculateWH(String units, uint16_t &w, uint16_t &h) { | |||
| int x = 0; | |||
| int y = 0; | |||
| int16_t x1, y1; | |||
| uint16_t w1, h1; | |||
| ssd1306.getTextBounds(units, x, y, &x1, &y1, &w1, &h1); | |||
| w = w1; | |||
| h = h1; | |||
| } | |||
| @@ -0,0 +1,39 @@ | |||
| /* | |||
| * Display.h | |||
| * | |||
| * Wrapper class for Adafruit OLED display. | |||
| * | |||
| * Created on: 28.01.2022 | |||
| * Author: FSmilari | |||
| */ | |||
| #ifndef DISPLAY_H_ | |||
| #define DISPLAY_H_ | |||
| #include<Adafruit_SSD1306.h> | |||
| #include <stdint.h> | |||
| #include "fonts/titillium_web_6pt7b.h" | |||
| #include "fonts/titillium_web_8pt7b.h" | |||
| #include "fonts/titillium_web_12pt7b.h" | |||
| #include "fonts/titillium_web_24pt7b.h" | |||
| #include "fonts/titillium_web_30pt7b.h" | |||
| #include "fonts/SFToolsLogo.h" | |||
| #define SCREEN_WIDTH 128 | |||
| #define SCREEN_HEIGHT 64 | |||
| #define SCREEN_ADDRESS 0x3C | |||
| class Display { | |||
| private: | |||
| Adafruit_SSD1306 ssd1306; | |||
| void calculateWH(String units, uint16_t &w, uint16_t &h); | |||
| public: | |||
| Display(); | |||
| void init(void); | |||
| void display(void); | |||
| void clearDisplay(void); | |||
| void showBrand(void); | |||
| void showInitialization(void); | |||
| }; | |||
| #endif /* DISPLAY_H_ */ | |||
| @@ -7,6 +7,9 @@ | |||
| #include "ExEzButton.h" | |||
| /***************** | |||
| ** Constructors. | |||
| ****************/ | |||
| ExEzButton::ExEzButton(int pin) : | |||
| ExEzButton(pin, false) { | |||
| } | |||
| @@ -23,6 +26,9 @@ ExEzButton::ExEzButton(int pin, bool _inverted, int _longpressTime) : | |||
| releasedTime = 0; | |||
| } | |||
| /****************** | |||
| ** Public methods | |||
| *****************/ | |||
| void ExEzButton::loop(void) { | |||
| int lastSteadyStateBefore = getState(); | |||
| ezButton::loop(); | |||
| @@ -15,28 +15,21 @@ | |||
| #include <Arduino.h> | |||
| #include <RotaryEncoder.h> | |||
| #include "WLS.h" | |||
| #include "ExEzButton.h" | |||
| #include <Wire.h> | |||
| #include <Adafruit_GFX.h> | |||
| #include <Adafruit_SSD1306.h> | |||
| #include <ESP_FlexyStepper.h> | |||
| #include "fonts/titillium_web_6pt7b.h" | |||
| #include "fonts/titillium_web_8pt7b.h" | |||
| #include "fonts/titillium_web_12pt7b.h" | |||
| #include "fonts/titillium_web_24pt7b.h" | |||
| #include "fonts/titillium_web_30pt7b.h" | |||
| #define SCREEN_WIDTH 128 | |||
| #define SCREEN_HEIGHT 64 | |||
| #define SCREEN_ADDRESS 0x3C | |||
| #include "Display.h" | |||
| #include "WLS.h" | |||
| #include "ExEzButton.h" | |||
| #include "RouterSetup.h" | |||
| #include "Status.h" | |||
| #define SDA 22 | |||
| #define SCX 23 | |||
| #define STEP 2 | |||
| #define DIR 4 | |||
| #define LIMIT_SWITCH 5 | |||
| static const byte led_gpio = 15; | |||
| static const int WLS_Pin = 34; | |||
| @@ -50,17 +43,12 @@ static const int RotEnc_Switch_Pin = 25; | |||
| static const int RotEnc_Clk_Pin = 32; | |||
| static const int RotEnc_Dta_Pin = 33; | |||
| // Speed settings | |||
| const int DISTANCE_TO_TRAVEL_IN_STEPS = 2000; | |||
| const int SPEED_IN_STEPS_PER_SECOND = 300; | |||
| const int ACCELERATION_IN_STEPS_PER_SECOND = 800; | |||
| const int DECELERATION_IN_STEPS_PER_SECOND = 800; | |||
| static const float MOVE_DOWNWARD = -1; // motor rotation counter clock wise | |||
| static const float MOVE_UPWARD = 1; // motor rotation clock wise | |||
| //variables for software debouncing of the limit switches | |||
| unsigned long lastDebounceTime = 0; | |||
| unsigned long debounceDelay = 100; //the minimum delay in milliseconds to check for bouncing of the switch. Increase this slighlty if you switches tend to bounce a lot | |||
| byte limitSwitchState = 1; | |||
| byte oldConfirmedLimitSwitchState = 0; | |||
| int previousDirection = 0; | |||
| int nullingTLS_intermediateState = 0; | |||
| ExEzButton RedButton(RedBtn_Pin, false, 2000); | |||
| ExEzButton GreenButton(GreenBtn_Pin, false, 2000); | |||
| @@ -71,34 +59,65 @@ WLS WlsDetect(WLS_DETECT_Pin, true); | |||
| WLS Wls(WLS_Pin); | |||
| RotaryEncoder encoder(RotEnc_Dta_Pin, RotEnc_Clk_Pin, RotaryEncoder::LatchMode::FOUR3); | |||
| Adafruit_SSD1306 Display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1); // SCK on Pin 23, SDA on PIN 22 | |||
| Display Display; | |||
| ESP_FlexyStepper stepper; | |||
| RouterSetup routerSetup; | |||
| int previousDirection = 1; | |||
| Status actualStatus; | |||
| Status originStatus; | |||
| String oldStatus = ""; | |||
| void printStatus(String actualStatus) { | |||
| if (!oldStatus.equals(actualStatus)) { | |||
| Serial.println(actualStatus); | |||
| oldStatus = actualStatus; | |||
| } | |||
| } | |||
| void limitSwitchHandler() | |||
| { | |||
| //********************************** | |||
| //*** Limit switch interrupt routine | |||
| //********************************** | |||
| void limitSwitchHandler() { | |||
| limitSwitchState = digitalRead(LIMIT_SWITCH); | |||
| lastDebounceTime = millis(); | |||
| } | |||
| //***************************************************************************************************** | |||
| //*** Initialization routine. Reads the eeprom first and sets the (potentially new) configured values. | |||
| //***************************************************************************************************** | |||
| void Initialize() { | |||
| routerSetup.readFromEEPROM(); | |||
| routerSetup.printValues(); | |||
| Display.showInitialization(); | |||
| //attach an interrupt to the IO pin of the limit switch and specify the handler function | |||
| attachInterrupt(digitalPinToInterrupt(LIMIT_SWITCH), limitSwitchHandler, CHANGE); | |||
| stepper.connectToPins(STEP, DIR); | |||
| // set the speed and acceleration rates for the stepper motor | |||
| stepper.setSpeedInStepsPerSecond(routerSetup.getSpeed() * routerSetup.getStepsPerRev()); | |||
| stepper.setStepsPerRevolution(routerSetup.getStepsPerRev()); | |||
| stepper.setStepsPerMillimeter(routerSetup.getStepsPerRev() / routerSetup.getPitch()); | |||
| stepper.setAccelerationInStepsPerSecondPerSecond(routerSetup.getAcceleration() * routerSetup.getStepsPerRev()); | |||
| stepper.setDecelerationInStepsPerSecondPerSecond(routerSetup.getAcceleration() * routerSetup.getStepsPerRev()); | |||
| stepper.startAsService(0); | |||
| if (routerSetup.isToolChangOnPowerOn()) { | |||
| actualStatus = TOOL_CHANGE; | |||
| } else { | |||
| actualStatus = IDLE; | |||
| } | |||
| } | |||
| //********************** | |||
| //*** SETUP ************ | |||
| //********************** | |||
| void setup() { | |||
| actualStatus = INITIALIZATION; | |||
| Wire.begin(SDA, SCX); | |||
| Serial.begin(115200); | |||
| if (!Display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS, true, true)) { | |||
| Serial.println(F("SSD1306 allocation failed")); | |||
| for (;;) | |||
| ; // Don't proceed, loop forever | |||
| } | |||
| Display.init(); | |||
| Display.display(); | |||
| pinMode(led_gpio, OUTPUT); | |||
| pinMode(GreenBtn_Pin, INPUT); | |||
| @@ -116,24 +135,10 @@ void setup() { | |||
| Wls.setDebounceTime(50); | |||
| RotarySwitch.setDebounceTime(50); | |||
| Display.display(); | |||
| delay(2000); // Pause for 2 seconds | |||
| // testdrawchar(); | |||
| // delay(5000); // Pause for 5 seconds | |||
| testdrawstyles(); | |||
| //attach an interrupt to the IO pin of the limit switch and specify the handler function | |||
| // attachInterrupt(digitalPinToInterrupt(LIMIT_SWITCH), limitSwitchHandler, CHANGE); | |||
| // | |||
| // stepper.connectToPins(STEP, DIR); | |||
| // set the speed and acceleration rates for the stepper motor | |||
| // stepper.setSpeedInStepsPerSecond(SPEED_IN_STEPS_PER_SECOND); | |||
| // stepper.setAccelerationInStepsPerSecondPerSecond(ACCELERATION_IN_STEPS_PER_SECOND); | |||
| // stepper.setDecelerationInStepsPerSecondPerSecond(DECELERATION_IN_STEPS_PER_SECOND); | |||
| // | |||
| // stepper.startAsService(1); | |||
| delay(1500); | |||
| Display.showBrand(); | |||
| delay(1500); | |||
| Initialize(); | |||
| } | |||
| //********************** | |||
| @@ -147,60 +152,184 @@ void loop() { | |||
| Wls.loop(); | |||
| RotarySwitch.loop(); | |||
| if (WlsDetect.isPlugged()) { | |||
| Serial.println("The WLS was connected"); | |||
| } else if (WlsDetect.isUnplugged()) { | |||
| Serial.println("The WLS was disconnected"); | |||
| switch (actualStatus) { | |||
| case INITIALIZATION: | |||
| Initialize(); | |||
| break; | |||
| case TOOL_CHANGE: | |||
| printStatus("TOOL_CHANGE"); | |||
| if (RotarySwitch.isLongPressed()) { | |||
| actualStatus = CONFIGURATION; | |||
| } else if (BlueButton.isPressed()) { | |||
| actualStatus = IDLE; | |||
| } | |||
| break; | |||
| case CONFIGURATION: | |||
| printStatus("CONFIGURATION"); | |||
| if (RotarySwitch.isLongPressed()) { | |||
| actualStatus = INITIALIZATION; | |||
| } else if (BlueButton.isPressed()) { | |||
| actualStatus = IDLE; | |||
| } | |||
| break; | |||
| case NULLING: | |||
| printStatus("NULLING"); | |||
| if (RedButton.isPressed()) { | |||
| stepper.setCurrentPositionInMillimeters(0); | |||
| stepper.setTargetPositionRelativeInMillimeters(0); | |||
| actualStatus = IDLE; | |||
| } | |||
| break; | |||
| case NULLING_TLS: | |||
| originStatus = NULLING_TLS; | |||
| if (nullingTLS_intermediateState == 0) { | |||
| printStatus("NULLING_TLS,0"); | |||
| //Move elevator to lowest point (lower limit switch triggers) | |||
| stepper.setTargetPositionRelativeInMillimeters(300 * MOVE_DOWNWARD); | |||
| actualStatus = MOVING_ELEVATOR; | |||
| nullingTLS_intermediateState = 1; | |||
| } else if (nullingTLS_intermediateState == 1) { | |||
| printStatus("NULLING_TLS,1"); | |||
| if (RedButton.isPressed()) { | |||
| //Move elevator until it touch the TLS (WLS_PIN goes HIGH) | |||
| stepper.setTargetPositionRelativeInMillimeters(300 * MOVE_UPWARD); | |||
| actualStatus = MOVING_ELEVATOR; | |||
| nullingTLS_intermediateState = 2; | |||
| } | |||
| } else if (nullingTLS_intermediateState == 2) { | |||
| printStatus("NULLING_TLS,2"); | |||
| //Move elevator back about toolLenghtSensorHeight (will be the 0-Position) | |||
| stepper.clearLimitSwitchActive(); | |||
| stepper.setTargetPositionRelativeInMillimeters(routerSetup.getToolLenghtSensorHeight() * MOVE_DOWNWARD); | |||
| Serial.println(String(routerSetup.getToolLenghtSensorHeight() * MOVE_DOWNWARD, 2)); | |||
| actualStatus = MOVING_ELEVATOR; | |||
| nullingTLS_intermediateState = 3; | |||
| } else { // nullingTLS_intermediateState is 3 | |||
| printStatus("NULLING_TLS,3"); | |||
| //Set the 0-Position as actual position | |||
| stepper.setCurrentPositionInMillimeters(0); | |||
| stepper.setTargetPositionRelativeInMillimeters(0); | |||
| actualStatus = IDLE; | |||
| nullingTLS_intermediateState = 0; | |||
| } | |||
| break; | |||
| case IDLE: | |||
| printStatus("IDLE"); | |||
| if (RedButton.isLongPressed()) { | |||
| if (WlsDetect.isConnected()) { | |||
| actualStatus = NULLING_TLS; | |||
| } else { | |||
| actualStatus = NULLING; | |||
| } | |||
| } else if (BlueButton.isLongPressed()) { | |||
| actualStatus = TOOL_CHANGE; | |||
| } | |||
| break; | |||
| case DIVING: | |||
| break; | |||
| case MOVING_ELEVATOR: | |||
| printStatus("MOVING_ELEVATOR"); | |||
| if (limitSwitchState == LOW) { | |||
| // this will cause to stop any motion that is currently going on and block further movement in the same direction as long as the switch is active | |||
| stepper.setLimitSwitchActive(stepper.LIMIT_SWITCH_COMBINED_BEGIN_AND_END); | |||
| delay(200); | |||
| actualStatus = RELEASE_SWITCH; | |||
| } else { // limitSwitchState is HIGH | |||
| if (stepper.getDistanceToTargetSigned() == 0) { | |||
| actualStatus = originStatus; | |||
| delay(200); | |||
| } else if (WlsDetect.isConnected()) { | |||
| if (Wls.isPlugged()) { | |||
| Serial.println("The Tool is away from WLS"); | |||
| stepper.clearLimitSwitchActive(); | |||
| } else if (Wls.isUnplugged()) { | |||
| Serial.println("The Tool touched the WLS"); | |||
| stepper.setLimitSwitchActive(stepper.LIMIT_SWITCH_COMBINED_BEGIN_AND_END); | |||
| actualStatus = originStatus; | |||
| delay(200); | |||
| } | |||
| } | |||
| stepper.clearLimitSwitchActive(); | |||
| previousDirection = stepper.getDirectionOfMotion(); | |||
| } | |||
| break; | |||
| case RELEASE_SWITCH: | |||
| if (limitSwitchState == LOW) { | |||
| stepper.moveRelativeInMillimeters(0.05 * previousDirection * -1); // move in opposite direction (away from switch) | |||
| } else { | |||
| actualStatus = originStatus; | |||
| } | |||
| break; | |||
| default: | |||
| break; | |||
| } | |||
| if (WlsDetect.getStateRaw() == HIGH) { | |||
| if (Wls.isPlugged()) { | |||
| Serial.println("The Tool is away from WLS"); | |||
| } else if (Wls.isUnplugged()) { | |||
| Serial.println("The Tool touched the WLS"); | |||
| } | |||
| } | |||
| if (RedButton.isPressed()) { | |||
| Serial.println("Red button was pressed"); | |||
| digitalWrite(led_gpio, HIGH); | |||
| Serial.print("Limit Switch: "); | |||
| Serial.println(digitalRead(LIMIT_SWITCH) ? "HIGH" : "LOW"); | |||
| } | |||
| //*********************** OLD EXAMPLE AND EXPERIMENTAL CODE ************************************ | |||
| if (RedButton.isLongPressed()) { | |||
| Serial.println("Red button was long pressed"); | |||
| digitalWrite(led_gpio, LOW); | |||
| } | |||
| bool greenPressed = GreenButton.isPressed(); | |||
| bool bluePressed = BlueButton.isPressed(); | |||
| if (GreenButton.isPressing() && BlueButton.isPressing()) { | |||
| Serial.println("Blue and green button were simultaneous pressed"); | |||
| } else if (greenPressed) { | |||
| Serial.println("Green button was pressed"); | |||
| } else if (bluePressed) { | |||
| Serial.println("Blue button was pressed"); | |||
| } | |||
| if (RotarySwitch.isPressed()) { | |||
| Serial.println("Rotary switch was pressed"); | |||
| } | |||
| if (RotarySwitch.isLongPressed()) { | |||
| Serial.println("Rotary switch long was pressed"); | |||
| } | |||
| static int pos = 0; | |||
| encoder.tick(); | |||
| int newPos = encoder.getPosition(); | |||
| if (pos != newPos) { | |||
| Serial.print("pos:"); | |||
| Serial.print(newPos); | |||
| Serial.print(" dir:"); | |||
| Serial.println((int) (encoder.getDirection())); | |||
| pos = newPos; | |||
| } | |||
| // if (WlsDetect.isPlugged()) { | |||
| // Serial.println("The WLS was connected"); | |||
| // } else if (WlsDetect.isUnplugged()) { | |||
| // Serial.println("The WLS was disconnected"); | |||
| // } | |||
| // | |||
| // if (WlsDetect.getStateRaw() == HIGH) { | |||
| // if (Wls.isPlugged()) { | |||
| // Serial.println("The Tool is away from WLS"); | |||
| // } else if (Wls.isUnplugged()) { | |||
| // Serial.println("The Tool touched the WLS"); | |||
| // } | |||
| // } | |||
| // | |||
| // if (RedButton.isPressed()) { | |||
| // Serial.println("Red button was pressed"); | |||
| // digitalWrite(led_gpio, HIGH); | |||
| // Serial.print("Limit Switch: "); | |||
| // Serial.println(digitalRead(LIMIT_SWITCH) ? "HIGH" : "LOW"); | |||
| // } | |||
| // | |||
| // if (RedButton.isLongPressed()) { | |||
| // Serial.println("Red button was long pressed"); | |||
| // digitalWrite(led_gpio, LOW); | |||
| // } | |||
| // | |||
| // bool greenPressed = GreenButton.isPressed(); | |||
| // bool bluePressed = BlueButton.isPressed(); | |||
| // | |||
| // if (GreenButton.isPressing() && BlueButton.isPressing()) { | |||
| // Serial.println("Blue and green button were simultaneous pressed"); | |||
| // } else if (greenPressed) { | |||
| // Serial.println("Green button was pressed"); | |||
| // } else if (bluePressed) { | |||
| // Serial.println("Blue button was pressed"); | |||
| // } | |||
| // | |||
| // if (RotarySwitch.isPressed()) { | |||
| // Serial.println("Rotary switch was pressed"); | |||
| // } | |||
| // if (RotarySwitch.isLongPressed()) { | |||
| // Serial.println("Rotary switch long was pressed"); | |||
| // } | |||
| // | |||
| // static int pos = 0; | |||
| // encoder.tick(); | |||
| // int newPos = encoder.getPosition(); | |||
| // if (pos != newPos) { | |||
| // Serial.print("pos:"); | |||
| // Serial.print(newPos); | |||
| // Serial.print(" dir:"); | |||
| // Serial.println((int) (encoder.getDirection())); | |||
| // pos = newPos; | |||
| // } | |||
| // if (limitSwitchState == LOW) { | |||
| // stepper.setLimitSwitchActive(stepper.LIMIT_SWITCH_COMBINED_BEGIN_AND_END); // this will cause to stop any motion that is currently going on and block further movement in the same direction as long as the switch is agtive | |||
| @@ -218,29 +347,29 @@ void loop() { | |||
| } | |||
| void testdrawchar(void) { | |||
| Display.clearDisplay(); | |||
| Display.setTextSize(1); // Normal 1:1 pixel scale | |||
| Display.setTextColor(SSD1306_WHITE); // Draw white text | |||
| Display.setCursor(0, 0); // Start at top-left corner | |||
| Display.cp437(true); // Use full 256 char 'Code Page 437' font | |||
| // Not all the characters will fit on the Display. This is normal. | |||
| // Library will draw what it can and the rest will be clipped. | |||
| for (int16_t i = 0; i < 256; i++) { | |||
| if (i == '\n') | |||
| Display.write(' '); | |||
| else | |||
| Display.write(i); | |||
| } | |||
| Display.display(); | |||
| delay(2000); | |||
| } | |||
| void testdrawstyles(void) { | |||
| Display.clearDisplay(); | |||
| //void testdrawchar(void) { | |||
| // OLED.clearDisplay(); | |||
| // | |||
| // OLED.setTextSize(1); // Normal 1:1 pixel scale | |||
| // OLED.setTextColor(SSD1306_WHITE); // Draw white text | |||
| // OLED.setCursor(0, 0); // Start at top-left corner | |||
| // OLED.cp437(true); // Use full 256 char 'Code Page 437' font | |||
| // | |||
| // // Not all the characters will fit on the Display. This is normal. | |||
| // // Library will draw what it can and the rest will be clipped. | |||
| // for (int16_t i = 0; i < 256; i++) { | |||
| // if (i == '\n') | |||
| // OLED.write(' '); | |||
| // else | |||
| // OLED.write(i); | |||
| // } | |||
| // | |||
| // OLED.display(); | |||
| // delay(2000); | |||
| //} | |||
| // | |||
| //void testdrawstyles(void) { | |||
| // OLED.clearDisplay(); | |||
| // Display.setFont(&Rubik_Regular8pt7b); | |||
| // Display.setTextSize(1); // Normal 1:1 pixel scale | |||
| @@ -267,32 +396,32 @@ void testdrawstyles(void) { | |||
| // | |||
| // Display.clearDisplay(); | |||
| char decimals[3]; | |||
| uint16_t w = 0, h = 0; | |||
| for (int i = 0; i <= 99; i++) { | |||
| Display.clearDisplay(); | |||
| Display.setFont(&titillium_web_semibold30pt7b); | |||
| Display.setTextSize(1); // Normal 1:1 pixel scale | |||
| Display.setTextColor(SSD1306_WHITE); // Draw white text | |||
| sprintf(decimals, "%02d", i); | |||
| if (i < 33) { | |||
| calculateWH("99.", w, h); | |||
| Display.setCursor((SCREEN_WIDTH / 2 - 1) - w, SCREEN_HEIGHT / 2 + h / 2); | |||
| Display.print("99."); | |||
| } else if (i >= 33 && i < 66) { | |||
| calculateWH("01.", w, h); | |||
| Display.setCursor((SCREEN_WIDTH / 2 - 1) - w, SCREEN_HEIGHT / 2 + h / 2); | |||
| Display.print("01."); | |||
| } else { | |||
| calculateWH("77.", w, h); | |||
| Display.setCursor((SCREEN_WIDTH / 2 - 1) - w, SCREEN_HEIGHT / 2 + h / 2); | |||
| Display.print("77."); | |||
| } | |||
| Display.println(decimals); | |||
| Display.display(); | |||
| delay(100); | |||
| } | |||
| // char decimals[3]; | |||
| // uint16_t w = 0, h = 0; | |||
| // for (int i = 0; i <= 99; i++) { | |||
| // OLED.clearDisplay(); | |||
| // OLED.drawRect(0, 0, 128, 64, SSD1306_WHITE); | |||
| // OLED.setFont(&titillium_web_semibold30pt7b); | |||
| // OLED.setTextSize(1); // Normal 1:1 pixel scale | |||
| // OLED.setTextColor(SSD1306_WHITE); // Draw white text | |||
| // sprintf(decimals, "%02d", i); | |||
| // if (i < 33) { | |||
| // calculateWH("99.", w, h); | |||
| // OLED.setCursor((SCREEN_WIDTH / 2 - 1) - w, SCREEN_HEIGHT / 2 + h / 2); | |||
| // OLED.print("99."); | |||
| // } else if (i >= 33 && i < 66) { | |||
| // calculateWH("01.", w, h); | |||
| // OLED.setCursor((SCREEN_WIDTH / 2 - 1) - w, SCREEN_HEIGHT / 2 + h / 2); | |||
| // OLED.print("01."); | |||
| // } else { | |||
| // calculateWH("55.", w, h); | |||
| // OLED.setCursor((SCREEN_WIDTH / 2 - 1) - w, SCREEN_HEIGHT / 2 + h / 2); | |||
| // OLED.print("55."); | |||
| // } | |||
| // OLED.println(decimals); | |||
| // OLED.display(); | |||
| // delay(100); | |||
| // } | |||
| // Display.setFont(&Rubik_Regular30pt7b); | |||
| // Display.setTextSize(1); // Normal 1:1 pixel scale | |||
| @@ -311,7 +440,6 @@ void testdrawstyles(void) { | |||
| // Display.setCursor(0, 55); // Start at top-left corner | |||
| // Display.println(F("01.11")); | |||
| // Display.setTextColor(SSD1306_BLACK, SSD1306_WHITE); // Draw 'inverse' text | |||
| // Display.println("3.141592"); | |||
| // | |||
| @@ -320,18 +448,18 @@ void testdrawstyles(void) { | |||
| // Display.print(F("0x")); | |||
| // Display.println(0xDEADBEEF, HEX); | |||
| // | |||
| Display.display(); | |||
| delay(2000); | |||
| } | |||
| void calculateWH(String units, uint16_t &w, uint16_t &h) { | |||
| int x = 0; | |||
| int y = 0; | |||
| int16_t x1, y1; | |||
| uint16_t w1, h1; | |||
| // OLED.display(); | |||
| // delay(2000); | |||
| //} | |||
| Display.getTextBounds(units, x, y, &x1, &y1, &w1, &h1); | |||
| w = w1; | |||
| h = h1; | |||
| } | |||
| //void calculateWH(String units, uint16_t &w, uint16_t &h) { | |||
| // int x = 0; | |||
| // int y = 0; | |||
| // int16_t x1, y1; | |||
| // uint16_t w1, h1; | |||
| // | |||
| // OLED.getTextBounds(units, x, y, &x1, &y1, &w1, &h1); | |||
| // w = w1; | |||
| // h = h1; | |||
| //} | |||
| @@ -0,0 +1,145 @@ | |||
| /* | |||
| * RouterSetup.cpp | |||
| * | |||
| * Created on: 25.01.2022 | |||
| * Author: FSmilari | |||
| */ | |||
| #include "RouterSetup.h" | |||
| /****************** | |||
| ** Public methods | |||
| *****************/ | |||
| float RouterSetup::getSpeed() const { | |||
| return speed; | |||
| } | |||
| void RouterSetup::setSpeed(float speed) { | |||
| this->speed = speed; | |||
| } | |||
| float RouterSetup::getAcceleration() const { | |||
| return accelleration; | |||
| } | |||
| void RouterSetup::setAcceleration(float accelleration) { | |||
| this->accelleration = accelleration; | |||
| } | |||
| uint8_t RouterSetup::getEncoderSpeedFast() const { | |||
| return encoderSpeedFast; | |||
| } | |||
| void RouterSetup::setEncoderSpeedFast(uint8_t encoderSpeedFast) { | |||
| this->encoderSpeedFast = encoderSpeedFast; | |||
| } | |||
| uint8_t RouterSetup::getEncoderSpeedSlow() const { | |||
| return encoderSpeedSlow; | |||
| } | |||
| void RouterSetup::setEncoderSpeedSlow(uint8_t encoderSpeedSlow) { | |||
| this->encoderSpeedSlow = encoderSpeedSlow; | |||
| } | |||
| float RouterSetup::getLevelHeightDiving() const { | |||
| return levelHeightDiving; | |||
| } | |||
| void RouterSetup::setLevelHeightDiving(float levelHeightDiving) { | |||
| this->levelHeightDiving = levelHeightDiving; | |||
| } | |||
| float RouterSetup::getPitch() const { | |||
| return pitch; | |||
| } | |||
| void RouterSetup::setPitch(float pitch) { | |||
| this->pitch = pitch; | |||
| } | |||
| uint16_t RouterSetup::getStepsPerRev() const { | |||
| return stepsPerRev; | |||
| } | |||
| void RouterSetup::setStepsPerRev(uint16_t stepsPerRev) { | |||
| this->stepsPerRev = stepsPerRev; | |||
| } | |||
| float RouterSetup::getToolLenghtSensorHeight() const { | |||
| return toolLenghtSensorHeight; | |||
| } | |||
| void RouterSetup::setToolLenghtSensorHeight(float toolLenghtSensorHeight) { | |||
| this->toolLenghtSensorHeight = toolLenghtSensorHeight; | |||
| } | |||
| bool RouterSetup::isToolChangOnPowerOn() const { | |||
| return toolChangeOnPowerOn; | |||
| } | |||
| void RouterSetup::setToolChangOnPowerOn(bool toolChangOnPowerOn) { | |||
| this->toolChangeOnPowerOn = toolChangOnPowerOn; | |||
| } | |||
| void RouterSetup::clear() { | |||
| speed = 0; | |||
| accelleration = 0; | |||
| stepsPerRev = 0; | |||
| pitch = 0; | |||
| toolLenghtSensorHeight = 0; | |||
| encoderSpeedSlow = 0; | |||
| encoderSpeedFast = 0; | |||
| levelHeightDiving = 0; | |||
| toolChangeOnPowerOn = true; | |||
| } | |||
| /** | |||
| * Reads the RouterSetup from EEPROM | |||
| */ | |||
| void RouterSetup::readFromEEPROM() { | |||
| clear(); | |||
| eeprom.begin(ROUTER_NAMESPACE, false); | |||
| setSpeed(eeprom.getFloat(SPEED, 1.0)); | |||
| setAcceleration(eeprom.getFloat(ACCELERATION, 1.0)); | |||
| setStepsPerRev(eeprom.getUInt(STEPSPERREV, 1600)); | |||
| setPitch(eeprom.getInt(PITCH, 3.0)); | |||
| setToolLenghtSensorHeight(eeprom.getFloat(TOOLLENGHTSNHT, 10.0)); | |||
| setEncoderSpeedSlow(eeprom.getInt(ENCSPEEDSLOW, 1)); | |||
| setEncoderSpeedFast(eeprom.getInt(ENCSPEEDFAST, 20)); | |||
| setLevelHeightDiving(eeprom.getFloat(LVLHEIGHTDIVE, 3.0)); | |||
| setToolChangOnPowerOn(eeprom.getBool(TOOLCHGONPWRON, true)); | |||
| eeprom.end(); | |||
| } | |||
| /** | |||
| * Writes the RouterSetup to EEPROM | |||
| */ | |||
| void RouterSetup::saveToEEPROM() { | |||
| eeprom.begin(ROUTER_NAMESPACE, false); | |||
| eeprom.putFloat(SPEED, getSpeed()); | |||
| eeprom.putFloat(ACCELERATION, getAcceleration()); | |||
| eeprom.putUInt(STEPSPERREV, getStepsPerRev()); | |||
| eeprom.putInt(PITCH, getPitch()); | |||
| eeprom.putFloat(TOOLLENGHTSNHT, getToolLenghtSensorHeight()); | |||
| eeprom.putInt(ENCSPEEDSLOW, getEncoderSpeedSlow()); | |||
| eeprom.putInt(ENCSPEEDFAST, getEncoderSpeedFast()); | |||
| eeprom.putFloat(LVLHEIGHTDIVE, getLevelHeightDiving()); | |||
| eeprom.putBool(TOOLCHGONPWRON, isToolChangOnPowerOn()); | |||
| eeprom.end(); | |||
| } | |||
| void RouterSetup::printValues() { | |||
| Serial.print(String(SPEED) + ": " + String(getSpeed(), 1) + ", "); | |||
| Serial.print(String(ACCELERATION) + ": " + String(getAcceleration(), 1) + ", "); | |||
| Serial.print(String(STEPSPERREV) + ": " + String(getStepsPerRev()) + ", "); | |||
| Serial.print(String(PITCH) + ": " + String(getPitch(), 1) + ", "); | |||
| Serial.print(String(TOOLLENGHTSNHT) + ": " + String(getToolLenghtSensorHeight(), 2) + ", "); | |||
| Serial.print(String(ENCSPEEDSLOW) + ": " + String(getEncoderSpeedSlow()) + ", "); | |||
| Serial.print(String(ENCSPEEDFAST) + ": " + String(getEncoderSpeedFast()) + ", "); | |||
| Serial.print(String(LVLHEIGHTDIVE) + ": " + String(getLevelHeightDiving(), 2) + ", "); | |||
| Serial.println(String(TOOLCHGONPWRON) + ": " + String(isToolChangOnPowerOn())); | |||
| } | |||
| @@ -0,0 +1,71 @@ | |||
| /* | |||
| * RouterSetup.h | |||
| * | |||
| * Created on: 25.01.2022 | |||
| * Author: FSmilari | |||
| */ | |||
| #ifndef ROUTER_SETUP_H_ | |||
| #define ROUTER_SETUP_H_ | |||
| #include <stdint.h> | |||
| #include <Preferences.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"; | |||
| class RouterSetup { | |||
| private: | |||
| Preferences eeprom; | |||
| float speed; // in revolutions/second (U/s) | |||
| float accelleration; // in revolutions/second (U/s) | |||
| 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 | |||
| public: | |||
| const static int eeprom_start_adress = 0; | |||
| const static int eeprom_signatur = 1024; | |||
| const static uint8_t version = 1; | |||
| 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 printValues(); | |||
| }; | |||
| #endif /* ROUTER_SETUP_H_ */ | |||
| @@ -0,0 +1,16 @@ | |||
| /* | |||
| * Status.h | |||
| * | |||
| * Created on: 28.01.2022 | |||
| * Author: FSmilari | |||
| */ | |||
| #ifndef STATUS_H_ | |||
| #define STATUS_H_ | |||
| enum Status { | |||
| INITIALIZATION, TOOL_CHANGE, CONFIGURATION, NULLING, NULLING_TLS, IDLE, DIVING, MOVING_ELEVATOR, RELEASE_SWITCH | |||
| }; | |||
| #endif /* STATUS_H_ */ | |||
| @@ -8,16 +8,19 @@ | |||
| #include "WLS.h" | |||
| WLS::WLS(int pin) : | |||
| WLS(pin, false) { | |||
| /***************** | |||
| ** Constructors. | |||
| ****************/ | |||
| WLS::WLS(int pin) : WLS(pin, false) { | |||
| } | |||
| WLS::WLS(int pin, bool _inverted) : | |||
| ezButton(pin) { | |||
| WLS::WLS(int pin, bool _inverted) : ezButton(pin) { | |||
| inverted = _inverted; | |||
| } | |||
| /****************** | |||
| ** Public methods | |||
| *****************/ | |||
| bool WLS::isPlugged(void) { | |||
| if (inverted) | |||
| return isReleased(); | |||
| @@ -33,3 +36,10 @@ bool WLS::isUnplugged(void) { | |||
| } | |||
| bool WLS::isConnected(void) { | |||
| if (inverted) { | |||
| return getStateRaw() == HIGH; | |||
| } else { | |||
| return getStateRaw() == LOW; | |||
| } | |||
| } | |||
| @@ -5,21 +5,23 @@ | |||
| * Autor: Flo Smilari | |||
| */ | |||
| #ifndef WLS_H_ | |||
| #define WLS_H_ | |||
| #include <ezButton.h> | |||
| class WLS: public ezButton { | |||
| private: | |||
| bool inverted; | |||
| bool inverted; | |||
| public: | |||
| WLS(int pin); | |||
| WLS(int pin, bool _inverted); | |||
| bool isPlugged(void); | |||
| bool isUnplugged(void); | |||
| WLS(int pin); | |||
| WLS(int pin, bool _inverted); | |||
| bool isPlugged(void); | |||
| bool isUnplugged(void); | |||
| bool isConnected(void); | |||
| }; | |||
| //Added by Sloeber | |||
| #pragma once | |||
| //Added by Sloeber | |||
| #endif | |||
| @@ -0,0 +1,58 @@ | |||
| // Filename: SFTools-Logo.png | |||
| // Filesize: 1300 Bytes | |||
| // Size bitmap: 640 bytes | |||
| #ifndef _SFTOOLSLOGO_H_ | |||
| #define _SFTOOLSLOGO_H_ | |||
| #define imageWidth 128 | |||
| #define imageHeight 34 | |||
| // 'SFTools-Logo', 128x34px | |||
| const unsigned char epd_bitmap_SFTools_Logo [] PROGMEM = { | |||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |||
| 0x01, 0xff, 0xfe, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0x78, 0xff, 0xf8, | |||
| 0x07, 0xff, 0xfe, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0x73, 0xff, 0xf8, | |||
| 0x0f, 0xff, 0xfe, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0x67, 0xff, 0xf8, | |||
| 0x1f, 0xff, 0xfe, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0x6f, 0xff, 0xf8, | |||
| 0x1f, 0xff, 0xfe, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0x6f, 0xff, 0xf8, | |||
| 0x1f, 0x80, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x0f, 0xc0, 0x00, | |||
| 0x1f, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x0f, 0x80, 0x00, | |||
| 0x1f, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x0f, 0x80, 0x00, | |||
| 0x1f, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x0f, 0x80, 0x00, | |||
| 0x1f, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x0f, 0x80, 0x00, | |||
| 0x1f, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x0f, 0x80, 0x00, | |||
| 0x1f, 0x80, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x0f, 0xc0, 0x00, | |||
| 0x1f, 0xff, 0x00, 0xff, 0xfc, 0x00, 0xf8, 0x07, 0xfc, 0x00, 0x3f, 0xe0, 0x1f, 0x0f, 0xff, 0x80, | |||
| 0x1f, 0xff, 0xc0, 0xff, 0xfc, 0x00, 0xf8, 0x1f, 0xff, 0x00, 0xff, 0xf8, 0x1f, 0x0f, 0xff, 0xe0, | |||
| 0x1f, 0xff, 0xe0, 0xff, 0xfc, 0x00, 0xf8, 0x3f, 0xff, 0x81, 0xff, 0xfc, 0x1f, 0x0f, 0xff, 0xf0, | |||
| 0x0f, 0xff, 0xe0, 0xff, 0xfc, 0x00, 0xf8, 0x3f, 0xff, 0x81, 0xff, 0xfc, 0x1f, 0x07, 0xff, 0xf0, | |||
| 0x07, 0xff, 0xf0, 0xff, 0xfc, 0x00, 0xf8, 0x7f, 0xff, 0xc3, 0xff, 0xfe, 0x1f, 0x03, 0xff, 0xf8, | |||
| 0x00, 0xff, 0xf0, 0xf8, 0x00, 0x00, 0xf8, 0x7e, 0x0f, 0xc3, 0xf0, 0x7e, 0x1f, 0x00, 0x7f, 0xf8, | |||
| 0x00, 0x03, 0xf0, 0xf8, 0x00, 0x00, 0xf8, 0x7c, 0x07, 0xc3, 0xe0, 0x3e, 0x1f, 0x00, 0x01, 0xf8, | |||
| 0x00, 0x01, 0xf0, 0xf8, 0x00, 0x00, 0xf8, 0x7c, 0x07, 0xc3, 0xe0, 0x3e, 0x1f, 0x00, 0x00, 0xf8, | |||
| 0x00, 0x01, 0xf0, 0xf8, 0x00, 0x00, 0xf8, 0x7c, 0x07, 0xc3, 0xe0, 0x3e, 0x1f, 0x00, 0x00, 0xf8, | |||
| 0x00, 0x01, 0xf0, 0xf8, 0x00, 0x00, 0xf8, 0x7c, 0x07, 0xc3, 0xe0, 0x3e, 0x1f, 0x00, 0x00, 0xf8, | |||
| 0x00, 0x01, 0xf0, 0xf8, 0x00, 0x00, 0xf8, 0x7c, 0x07, 0xc3, 0xe0, 0x3e, 0x1f, 0x00, 0x00, 0xf8, | |||
| 0x00, 0x03, 0xf0, 0xf8, 0x00, 0x00, 0xf8, 0x7e, 0x0f, 0xc3, 0xf0, 0x7e, 0x1f, 0x00, 0x01, 0xf8, | |||
| 0x1f, 0xff, 0xf0, 0xf8, 0x00, 0x00, 0xf8, 0x7f, 0xff, 0xc3, 0xff, 0xfe, 0x1f, 0x0f, 0xff, 0xf8, | |||
| 0x1f, 0xff, 0xe0, 0xf8, 0x00, 0x00, 0xf8, 0x3f, 0xff, 0x81, 0xff, 0xfc, 0x1f, 0x0f, 0xff, 0xf0, | |||
| 0x1f, 0xff, 0xe0, 0xf8, 0x00, 0x00, 0xf8, 0x3f, 0xff, 0x81, 0xff, 0xfc, 0x1f, 0x0f, 0xff, 0xf0, | |||
| 0x1f, 0xff, 0xc0, 0xf8, 0x00, 0x00, 0xf8, 0x1f, 0xff, 0x00, 0xff, 0xf8, 0x1f, 0x0f, 0xff, 0xe0, | |||
| 0x1f, 0xff, 0x80, 0xf8, 0x00, 0x00, 0xf8, 0x07, 0xfc, 0x00, 0x3f, 0xe0, 0x1f, 0x0f, 0xff, 0xc0, | |||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | |||
| }; | |||
| // Array of all bitmaps for convenience. (Total bytes used to store images in PROGMEM = 560) | |||
| //const int epd_bitmap_allArray_LEN = 1; | |||
| //const unsigned char *epd_bitmap_allArray[1] = { | |||
| // epd_bitmap_SFTools_Logo | |||
| //}; | |||
| #endif | |||
| @@ -2,29 +2,25 @@ | |||
| //This is a automatic generated file | |||
| //Please do not modify this file | |||
| //If you touch this file your change will be overwritten during the next build | |||
| //This file has been generated on 2022-01-23 21:46:12 | |||
| //This file has been generated on 2022-02-02 13:52:27 | |||
| #include "Arduino.h" | |||
| #include <Arduino.h> | |||
| #include <RotaryEncoder.h> | |||
| #include "WLS.h" | |||
| #include "ExEzButton.h" | |||
| #include <Wire.h> | |||
| #include <Adafruit_GFX.h> | |||
| #include <Adafruit_SSD1306.h> | |||
| #include <ESP_FlexyStepper.h> | |||
| #include "fonts/titillium_web_6pt7b.h" | |||
| #include "fonts/titillium_web_8pt7b.h" | |||
| #include "fonts/titillium_web_12pt7b.h" | |||
| #include "fonts/titillium_web_24pt7b.h" | |||
| #include "fonts/titillium_web_30pt7b.h" | |||
| #include "Display.h" | |||
| #include "WLS.h" | |||
| #include "ExEzButton.h" | |||
| #include "RouterSetup.h" | |||
| #include "Status.h" | |||
| void printStatus(String actualStatus) ; | |||
| void limitSwitchHandler() ; | |||
| void Initialize() ; | |||
| void setup() ; | |||
| void loop() ; | |||
| void testdrawchar(void) ; | |||
| void testdrawstyles(void) ; | |||
| void calculateWH(String units, uint16_t &w, uint16_t &h) ; | |||
| #include "Fraestisch_SFTools.ino" | |||