Browse Source

Max7219 non-functional tweaks

pull/1/head
Scott Lahteine 5 years ago
parent
commit
a7c41d28af
  1. 23
      Marlin/src/feature/Max7219_Debug_LEDs.cpp

23
Marlin/src/feature/Max7219_Debug_LEDs.cpp

@ -78,6 +78,7 @@ uint8_t Max7219::led_line[MAX7219_LINES]; // = { 0 };
#define LED_IND(X,Y) _LED_IND(Y,X)
#define LED_BIT(X,Y) _LED_BIT(Y)
#endif
#define XOR_7219(X,Y) do{ led_line[LED_IND(X,Y)] ^= _BV(LED_BIT(X,Y)); }while(0)
#define SET_7219(X,Y) do{ led_line[LED_IND(X,Y)] |= _BV(LED_BIT(X,Y)); }while(0)
#define CLR_7219(X,Y) do{ led_line[LED_IND(X,Y)] &= ~_BV(LED_BIT(X,Y)); }while(0)
@ -464,18 +465,18 @@ void Max7219::init() {
*/
// Apply changes to update a marker
void Max7219::mark16(const uint8_t y, const uint8_t v1, const uint8_t v2) {
void Max7219::mark16(const uint8_t pos, const uint8_t v1, const uint8_t v2) {
#if MAX7219_X_LEDS == 8
#if MAX7219_Y_LEDS == 8
led_off(v1 & 0x7, y + (v1 >= 8));
led_on(v2 & 0x7, y + (v2 >= 8));
led_off(v1 & 0x7, pos + (v1 >= 8));
led_on(v2 & 0x7, pos + (v2 >= 8));
#else
led_off(y, v1 & 0xF); // At least 16 LEDs down. Use a single column.
led_on(y, v2 & 0xF);
led_off(pos, v1 & 0xF); // At least 16 LEDs down. Use a single column.
led_on(pos, v2 & 0xF);
#endif
#else
led_off(v1 & 0xF, y); // At least 16 LEDs across. Use a single row.
led_on(v2 & 0xF, y);
led_off(v1 & 0xF, pos); // At least 16 LEDs across. Use a single row.
led_on(v2 & 0xF, pos);
#endif
}
@ -502,16 +503,16 @@ void Max7219::range16(const uint8_t y, const uint8_t ot, const uint8_t nt, const
}
// Apply changes to update a quantity
void Max7219::quantity16(const uint8_t y, const uint8_t ov, const uint8_t nv) {
void Max7219::quantity16(const uint8_t pos, const uint8_t ov, const uint8_t nv) {
for (uint8_t i = _MIN(nv, ov); i < _MAX(nv, ov); i++)
#if MAX7219_X_LEDS == 8
#if MAX7219_Y_LEDS == 8
led_set(i >> 1, y + (i & 1), nv >= ov); // single 8x8 LED matrix. Use two lines to get 16 LED's
led_set(i >> 1, pos + (i & 1), nv >= ov); // single 8x8 LED matrix. Use two lines to get 16 LED's
#else
led_set(y, i, nv >= ov); // The Max7219 Y-Axis has at least 16 LED's. So use a single column
led_set(pos, i, nv >= ov); // The Max7219 Y-Axis has at least 16 LED's. So use a single column
#endif
#else
led_set(i, y, nv >= ov); // LED matrix has at least 16 LED's on the X-Axis. Use single line of LED's
led_set(i, pos, nv >= ov); // LED matrix has at least 16 LED's on the X-Axis. Use single line of LED's
#endif
}

Loading…
Cancel
Save