From 9b386c3d73e041618979e0454e036f2eb7b9b2ff Mon Sep 17 00:00:00 2001 From: jonny_ji7 <jonny@wwad.de> Date: Mon, 19 Sep 2022 13:55:29 +0200 Subject: [PATCH] Add beep at AUTO_CUT toggle and CUT trigger cutter.hpp: change from enum to enum class control.cpp: add beeping to cut buttons --- main/control.cpp | 10 ++++++++++ main/cutter.hpp | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/main/control.cpp b/main/control.cpp index a6199cd..d5938c9 100644 --- a/main/control.cpp +++ b/main/control.cpp @@ -194,11 +194,21 @@ void task_control(void *pvParameter) //--- CUT switch --- + //start cut cycle immediately if (SW_CUT.risingEdge) { cutter_start(); + buzzer.beep(1, 70, 50); } + //--- beep at AUTO_CUT toggle --- + if (SW_AUTO_CUT.risingEdge){ + buzzer.beep(2, 100, 50); + } else if (SW_AUTO_CUT.fallingEdge) { + buzzer.beep(1, 400, 50); + } + + //--- manual mode --- //switch to manual motor control (2 buttons + poti) if ( SW_PRESET2.state && (SW_PRESET1.state || SW_PRESET3.state) && controlState != systemState_t::MANUAL ) { diff --git a/main/cutter.hpp b/main/cutter.hpp index 9e86a7a..3983f18 100644 --- a/main/cutter.hpp +++ b/main/cutter.hpp @@ -1,3 +1,5 @@ +#pragma once + extern "C" { #include <stdio.h> @@ -11,7 +13,7 @@ extern "C" //--- variables --- //enum for state of cutter -typedef enum cutter_state_t {IDLE, START, CUTTING, CANCELED, TIMEOUT} cutter_state_t; +enum class cutter_state_t {IDLE, START, CUTTING, CANCELED, TIMEOUT}; //string for logging the state name extern const char* cutter_stateStr[5];