forked from ClemensElflein/CoverUI
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b8b51fd
commit 77110e2
Showing
13 changed files
with
83 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
* @file Emergency.hpp | ||
* @author Apehaenger ([email protected]) | ||
* @brief YardForce CoverUI Emergency class for OpenMower https://github.com/ClemensElflein/OpenMower | ||
* @version 0.4 | ||
* @date 2024-10-02 | ||
* @version 0.5 | ||
* @date 2024-10-30 | ||
* | ||
* @copyright Copyright (c) 2023, 2024 | ||
* | ||
|
@@ -25,7 +25,7 @@ class Emergency { | |
struct PinStateDef { | ||
uint8_t pin; | ||
uint8_t pin_mode; | ||
Emergency_state state; | ||
EmergencyState state; | ||
}; | ||
|
||
const PinStateDef *kPinStatesPtr; // Pointer to an array of PinStateDef's (order doesn't matter) | ||
|
@@ -43,14 +43,14 @@ class Emergency { | |
* | ||
*/ | ||
void read() { | ||
state_ = 0; // We might have more emergency sensors and switch than OM Emergency_states. So we need to OR them instead of assign them 1:1 | ||
state_ = 0; | ||
for (size_t i = 0; i < kNumEmergencies; i++) { | ||
auto pin_state = *(kPinStatesPtr + i); | ||
if (digitalRead(pin_state.pin) == HIGH) | ||
state_ |= pin_state.state; | ||
state_ |= (int)pin_state.state; | ||
} | ||
if (state_) | ||
state_ |= Emergency_state::Emergency_latch; | ||
state_ |= (int)EmergencyState::LATCH; | ||
} | ||
|
||
/** | ||
|
@@ -73,7 +73,7 @@ class Emergency { | |
void read_and_send_if_emergency() { | ||
read(); | ||
|
||
if (state_ & Emergency_state::Emergency_latch && !(state_last_sent_ & Emergency_state::Emergency_latch)) { | ||
if (state_ & (int)EmergencyState::LATCH && !(state_last_sent_ & (int)EmergencyState::LATCH)) { | ||
send(); | ||
next_periodic_cycle = millis() + PERIODIC_SEND_CYCLE; | ||
} | ||
|
@@ -87,7 +87,7 @@ class Emergency { | |
*/ | ||
void periodic_send() { | ||
// Active emergency | ||
if (state_ & Emergency_state::Emergency_latch) { | ||
if (state_ & (int)EmergencyState::LATCH) { | ||
send(); | ||
next_periodic_cycle = millis() + PERIODIC_SEND_CYCLE; | ||
return; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
* @file C500/assembly.cpp | ||
* @author Apehaenger ([email protected]) | ||
* @brief YardForce RM-ECOW-V1.0.0 CoverUI Assembly for OpenMower https://github.com/ClemensElflein/OpenMower | ||
* @version 0.1 | ||
* @date 2024-10-01 | ||
* @version 0.2 | ||
* @date 2024-10-30 | ||
* | ||
* @copyright Copyright (c) 2024 | ||
* | ||
|
@@ -88,9 +88,9 @@ ButtonsC500 buttons(kBtnDefByButtonNumMap); | |
|
||
// ----- Emergency ----- | ||
const Emergency::PinStateDef kEmergencyPinStateDefs[] = { | ||
{PIN_HALL_STOP_WHITE, INPUT, Emergency_state::Emergency_stop1}, | ||
{PIN_HALL_STOP_YELLOW, INPUT, Emergency_state::Emergency_stop2}, | ||
{PIN_HALL_WHEEL_RED, INPUT, Emergency_state::Emergency_lift1}, | ||
{PIN_HALL_WHEEL_BLUE, INPUT, Emergency_state::Emergency_lift2}}; | ||
{PIN_HALL_STOP_WHITE, INPUT, EmergencyState::STOP1}, | ||
{PIN_HALL_STOP_YELLOW, INPUT, EmergencyState::STOP2}, | ||
{PIN_HALL_WHEEL_RED, INPUT, EmergencyState::LIFT}, | ||
{PIN_HALL_WHEEL_BLUE, INPUT, EmergencyState::LIFTX}}; | ||
|
||
Emergency emergency(kEmergencyPinStateDefs, sizeof(kEmergencyPinStateDefs) / sizeof(Emergency::PinStateDef)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
* @file RM-EC3-V11/assembly.hpp | ||
* @author Apehaenger ([email protected]) | ||
* @brief YardForce RM-EC3-V1.1 CoverUI Assembly for OpenMower https://github.com/ClemensElflein/OpenMower | ||
* @version 0.1 | ||
* @date 2024-10-01 | ||
* @version 0.2 | ||
* @date 2024-10-30 | ||
* | ||
* @copyright Copyright (c) 2024 | ||
* | ||
|
@@ -61,10 +61,10 @@ extern LEDcontrolRMEC3V11 leds; | |
#define PIN_STOP1 PC15 | ||
#define PIN_STOP2 PB6 | ||
|
||
#define PIN_HALL1 PB15 | ||
#define PIN_HALL2 PC0 | ||
#define PIN_HALL3 PC8 | ||
#define PIN_HALL4 PC9 | ||
#define PIN_LIFT PC0 | ||
#define PIN_LIFTX PC9 | ||
#define PIN_LBUMP PC8 | ||
#define PIN_RBUMP PB15 | ||
|
||
class ButtonsRMEC3V11 : public Buttons { | ||
public: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
* @file RM-ECOW-V100/assembly.cpp | ||
* @author Apehaenger ([email protected]) | ||
* @brief YardForce RM-ECOW-V1.0.0 CoverUI Assembly for OpenMower https://github.com/ClemensElflein/OpenMower | ||
* @version 0.1 | ||
* @date 2024-10-01 | ||
* @version 0.2 | ||
* @date 2024-10-30 | ||
* | ||
* @copyright Copyright (c) 2024 | ||
* | ||
|
@@ -87,14 +87,14 @@ ButtonsRMECOWV100 buttons(kBtnDefByButtonNumMap); | |
// ----- Emergency ----- | ||
const Emergency::PinStateDef kEmergencyPinStateDefs[] = { | ||
#ifdef MOD_HALL | ||
{PIN_HALL1, INPUT_PULLUP, Emergency_state::Emergency_lift1}, | ||
{PIN_HALL2, INPUT_PULLUP, Emergency_state::Emergency_lift1}, | ||
{PIN_HALL3, INPUT_PULLUP, Emergency_state::Emergency_lift2}, | ||
{PIN_HALL4, INPUT_PULLUP, Emergency_state::Emergency_lift2}, | ||
{PIN_LIFT, INPUT_PULLUP, EmergencyState::LIFT}, | ||
{PIN_LIFTX, INPUT_PULLUP, EmergencyState::LIFTX}, | ||
{PIN_LBUMP, INPUT_PULLUP, EmergencyState::LBUMP}, | ||
{PIN_RBUMP, INPUT_PULLUP, EmergencyState::RBUMP}, | ||
#endif | ||
#ifdef MOD_STOP | ||
{PIN_STOP_JP5, INPUT_PULLUP, Emergency_state::Emergency_stop1}, | ||
{PIN_STOP_JP6, INPUT_PULLUP, Emergency_state::Emergency_stop2} | ||
{PIN_STOP_JP5, INPUT_PULLUP, EmergencyState::STOP1}, | ||
{PIN_STOP_JP6, INPUT_PULLUP, EmergencyState::STOP2} | ||
#endif | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
* @file RM-ECOW-V100/assembly.hpp | ||
* @author Apehaenger ([email protected]) | ||
* @brief YardForce RM-ECOW-V1.0.0 CoverUI Assembly for OpenMower https://github.com/ClemensElflein/OpenMower | ||
* @version 0.1 | ||
* @date 2024-10-01 | ||
* @version 0.2 | ||
* @date 2024-10-30 | ||
* | ||
* @copyright Copyright (c) 2024 | ||
* | ||
|
@@ -55,10 +55,10 @@ | |
#define PIN_STOP_JP5 PC10 | ||
#define PIN_STOP_JP6 PA15 | ||
|
||
#define PIN_HALL1 PA8 // LIFT | ||
#define PIN_HALL2 PF6 // LIFTX | ||
#define PIN_HALL3 PA12 // LBUMP | ||
#define PIN_HALL4 PA11 // RBUMP | ||
#define PIN_LIFT PA8 | ||
#define PIN_LIFTX PF6 | ||
#define PIN_LBUMP PA12 | ||
#define PIN_RBUMP PA11 | ||
|
||
extern LEDcontrolRMECOWV1x leds; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
* @file RM-ECOW-V100/assembly.cpp | ||
* @author Apehaenger ([email protected]) | ||
* @brief YardForce RM-ECOW-V1.0.0 CoverUI Assembly for OpenMower https://github.com/ClemensElflein/OpenMower | ||
* @version 0.1 | ||
* @date 2024-10-01 | ||
* @version 0.2 | ||
* @date 2024-10-30 | ||
* | ||
* @copyright Copyright (c) 2024 | ||
* | ||
|
@@ -86,14 +86,14 @@ ButtonsRMECOWV110 buttons(kBtnDefByButtonNumMap); | |
// ----- Emergency ----- | ||
const Emergency::PinStateDef kEmergencyPinStateDefs[] = { | ||
#ifdef MOD_HALL | ||
{PIN_HALL1, INPUT_PULLUP, Emergency_state::Emergency_lift1}, | ||
{PIN_HALL2, INPUT_PULLUP, Emergency_state::Emergency_lift1}, | ||
{PIN_HALL3, INPUT_PULLUP, Emergency_state::Emergency_lift2}, | ||
{PIN_HALL4, INPUT_PULLUP, Emergency_state::Emergency_lift2}, | ||
{PIN_LIFT, INPUT_PULLUP, EmergencyState::LIFT}, | ||
{PIN_LIFTX, INPUT_PULLUP, EmergencyState::LIFTX}, | ||
{PIN_LBUMP, INPUT_PULLUP, EmergencyState::LBUMP}, | ||
{PIN_RBUMP, INPUT_PULLUP, EmergencyState::RBUMP}, | ||
#endif | ||
#ifdef MOD_STOP | ||
{PIN_STOP_JP6, INPUT_PULLUP, Emergency_state::Emergency_stop1}, | ||
{PIN_STOP_JP8, INPUT_PULLUP, Emergency_state::Emergency_stop2}, | ||
{PIN_STOP_JP6, INPUT_PULLUP, EmergencyState::STOP1}, | ||
{PIN_STOP_JP8, INPUT_PULLUP, EmergencyState::STOP2}, | ||
#endif | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters