Switch LEDs to match selected tool

pull/91/head
3d-gussner 2021-08-18 09:15:27 +02:00
parent 2053729a75
commit a2a1b8a698
3 changed files with 8 additions and 5 deletions

View File

@ -7,6 +7,8 @@ namespace config {
static constexpr const uint8_t toolCount = 5U; ///< Max number of extruders/tools/slots
static constexpr const uint8_t ledCount = 10U; ///< LED count
/// Absolute positions for Idler's slots: 0-4 are the real ones, the 5th index is the idle position
static constexpr U_deg idlerSlotPositions[toolCount + 1] = {
45.0_deg,

View File

@ -97,7 +97,7 @@ void setup() {
// watchdog init
shr16::shr16.Init();
ml::leds.SetMode(4, ml::Color::green, ml::Mode::blink0);
ml::leds.SetMode(0, ml::Color::green, ml::Mode::on);
ml::leds.Step();
// @@TODO if the shift register doesn't work we really can't signalize anything, only internal variables will be accessible if the UART works
@ -108,7 +108,7 @@ void setup() {
.baudrate = 115200,
};
hu::usart1.Init(&usart_conf);
ml::leds.SetMode(3, ml::Color::green, ml::Mode::on);
ml::leds.SetMode(1, ml::Color::green, ml::Mode::on);
ml::leds.Step();
// @@TODO if both shift register and the UART are dead, we are sitting ducks :(
@ -127,12 +127,13 @@ void setup() {
ml::leds.Step();
// tmc::Init()
ml::leds.SetMode(1, ml::Color::green, ml::Mode::on);
ml::leds.SetMode(3, ml::Color::green, ml::Mode::on);
ml::leds.Step();
adc::Init();
ml::leds.SetMode(0, ml::Color::green, ml::Mode::on);
ml::leds.SetMode(4, ml::Color::green, ml::Mode::on);
ml::leds.Step();
}
static constexpr const uint8_t maxMsgLen = 10;

View File

@ -79,7 +79,7 @@ public:
/// @param color green or red LED
/// @param mode to set
inline void SetMode(uint8_t slot, Color color, Mode mode) {
SetMode(slot * 2 + color, mode);
SetMode(((config::ledCount/2-1)-slot) * 2 + color, mode);
}
/// Sets the mode of a LED in a pair