Skip to content

Commit

Permalink
Implement review hints of rovo89
Browse files Browse the repository at this point in the history
  • Loading branch information
Apehaenger committed Oct 11, 2024
1 parent 9a50a05 commit 68ed301
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
6 changes: 4 additions & 2 deletions Firmware/LowLevel/include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
#define _CONFIG_H

#define BATT_ABS_MAX 28.7f
#define BATT_ABS_Min 21.7f
#define BATT_ABS_MIN 21.7f

#define BATT_EMPTY BATT_ABS_MIN + 0.3f
#define BATT_FULL BATT_ABS_MAX - 0.3f
#define BATT_EMPTY BATT_ABS_Min + 0.3f

#define V_BATT_CUTOFF 29.0f

#define TILT_EMERGENCY_MILLIS 2500 // Time for a single wheel to be lifted in order to count as emergency (0 disable). This is to filter uneven ground.
#define LIFT_EMERGENCY_MILLIS 100 // Time for both wheels to be lifted in order to count as emergency (0 disable). This is to filter uneven ground.
Expand Down
5 changes: 0 additions & 5 deletions Firmware/LowLevel/include/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

#ifdef USB_DEBUG
#define DEBUG_SERIAL Serial
// #define DfMiniMp3Debug DEBUG_SERIAL // Also output DFPlayer IN/OUT cmd data

// Some bloody simple debug macros which superfluous '#ifdef USB_DEBUG' ...
#define DEBUG_BEGIN(b) \
Expand All @@ -39,9 +38,5 @@
#define DEBUG_PRINTF(fmt, ...)
#endif

#define PRINTF_BINARY_PATTERN_INT8 "%c%c%c%c%c%c%c%c"
#define PRINTF_BYTE_TO_BINARY_INT8(i) \
(((i)&0x80ll) ? '1' : '0'), (((i)&0x40ll) ? '1' : '0'), (((i)&0x20ll) ? '1' : '0'), (((i)&0x10ll) ? '1' : '0'), \
(((i)&0x08ll) ? '1' : '0'), (((i)&0x04ll) ? '1' : '0'), (((i)&0x02ll) ? '1' : '0'), (((i)&0x01ll) ? '1' : '0')

#endif // _DEBUG_H_
8 changes: 4 additions & 4 deletions Firmware/LowLevel/src/datatypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ typedef char iso639_1[2]; // Two char ISO 639-1 language code

enum class HallMode : uint8_t {
off = 0,
emergency, // lift & tilt
stop,
pause
emergency, // Triggers emergency with lift & tilt functionality
stop, // Stop mower
pause // Pause the mower (not yet implemented in ROS)
};

// FIXME: Decide later which is more comfortable, activeLow = 0 | 1
Expand Down Expand Up @@ -176,7 +176,7 @@ struct ll_high_level_config {
uint16_t rain_threshold = 700; // If (stock CoverUI) rain value < rain_threshold then it rains. Expected to differ between C500, SA and SC types
float v_charge_cutoff = V_CHARGE_MAX; // Protective max. charging voltage before charging get switched off
float i_charge_cutoff = I_CHARGE_MAX; // Protective max. charging current before charging get switched off
float v_battery_cutoff = 29.0f; // Protective max. battery voltage before charging get switched off
float v_battery_cutoff = V_BATT_CUTOFF; // Protective max. battery voltage before charging get switched off
float v_battery_empty = BATT_EMPTY; // Empty battery voltage used for % calc of capacity
float v_battery_full = BATT_FULL; // Full battery voltage used for % calc of capacity
uint16_t lift_period = LIFT_EMERGENCY_MILLIS; // Period (ms) for both wheels to be lifted in order to count as emergency (0 disable, 0xFFFF do not change). This is to filter uneven ground
Expand Down
2 changes: 1 addition & 1 deletion Firmware/LowLevel/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ void setup() {
rp2040.idleOtherCore();

#ifdef USB_DEBUG
DEBUG_SERIAL.begin(9600);
DEBUG_BEGIN(9600);
#endif

emergency_latch = true;
Expand Down

0 comments on commit 68ed301

Please sign in to comment.