This commit is contained in:
Thomas Basler 2018-08-04 11:09:44 +02:00
commit e3398b2203
45 changed files with 62 additions and 62 deletions

View File

@ -10916,12 +10916,12 @@ inline void gcode_M502() {
Max7219_Clear(); Max7219_Clear();
if (parser.seen('F')) if (parser.seen('F'))
for(uint8_t x = 0; x < MAX7219_X_LEDS; x++) for (uint8_t x = 0; x < MAX7219_X_LEDS; x++)
Max7219_Set_Column(x, 0xffffffff); Max7219_Set_Column(x, 0xffffffff);
if (parser.seenval('R')) { if (parser.seenval('R')) {
const uint32_t r = parser.value_int(); const uint32_t r = parser.value_int();
Max7219_Set_Row(r, parser.ulongval('V')); Max7219_Set_Row(r, parser.byteval('V'));
return; return;
} }
else if (parser.seenval('C')) { else if (parser.seenval('C')) {
@ -10939,7 +10939,7 @@ inline void gcode_M502() {
} }
if (parser.seen('P')) { if (parser.seen('P')) {
for(uint8_t x = 0; x < (8*MAX7219_NUMBER_UNITS); x++) { for (uint8_t x = 0; x < (8 * MAX7219_NUMBER_UNITS); x++) {
SERIAL_ECHOPAIR("LEDs[", x); SERIAL_ECHOPAIR("LEDs[", x);
SERIAL_ECHOPAIR("]=", LEDs[x]); SERIAL_ECHOPAIR("]=", LEDs[x]);
SERIAL_ECHO("\n"); SERIAL_ECHO("\n");

View File

@ -48,7 +48,7 @@
#include "Marlin.h" #include "Marlin.h"
#include "delay.h" #include "delay.h"
uint8_t LEDs[8*MAX7219_NUMBER_UNITS] = { 0 }; uint8_t LEDs[8 * MAX7219_NUMBER_UNITS] = { 0 };
// Delay for 0.1875µs (16MHz AVR) or 0.15µs (20MHz AVR) // Delay for 0.1875µs (16MHz AVR) or 0.15µs (20MHz AVR)
#define SIG_DELAY() DELAY_NS(188) #define SIG_DELAY() DELAY_NS(188)
@ -191,7 +191,7 @@ inline void _Max7219_Set_Digit_Segments(const uint8_t digit, const uint8_t val)
void Max7219_Set_Row(const uint8_t row, const uint32_t val) { void Max7219_Set_Row(const uint8_t row, const uint32_t val) {
if (row >= MAX7219_Y_LEDS) return Max7219_Error(PSTR("Max7219_Set_Row"), row); if (row >= MAX7219_Y_LEDS) return Max7219_Error(PSTR("Max7219_Set_Row"), row);
uint32_t mask = 0x0000001; uint32_t mask = 0x0000001;
for(uint8_t x = 0; x < MAX7219_X_LEDS; x++) { for (uint8_t x = 0; x < MAX7219_X_LEDS; x++) {
if (val & mask) if (val & mask)
SET_PIXEL_7219(MAX7219_X_LEDS-1-x, row); SET_PIXEL_7219(MAX7219_X_LEDS-1-x, row);
else else
@ -199,7 +199,7 @@ void Max7219_Set_Row(const uint8_t row, const uint32_t val) {
mask <<= 1; mask <<= 1;
} }
#if _ROT == 90 || _ROT == 270 #if _ROT == 90 || _ROT == 270
for(uint8_t x = 0; x < 8; x++) for (uint8_t x = 0; x < 8; x++)
SEND_7219(x); // force all columns out to the Max7219 chips and strobe them SEND_7219(x); // force all columns out to the Max7219 chips and strobe them
#else #else
SEND_7219(row); // force the single column out to the Max7219 chips and strobe them SEND_7219(row); // force the single column out to the Max7219 chips and strobe them
@ -225,7 +225,7 @@ void Max7219_Clear_Row(const uint8_t row) {
void Max7219_Set_Column(const uint8_t col, const uint32_t val) { void Max7219_Set_Column(const uint8_t col, const uint32_t val) {
if (col >= MAX7219_X_LEDS) return Max7219_Error(PSTR("Max7219_Set_Column"), col); if (col >= MAX7219_X_LEDS) return Max7219_Error(PSTR("Max7219_Set_Column"), col);
uint32_t mask = 0x0000001; uint32_t mask = 0x0000001;
for(uint8_t y = 0; y < MAX7219_Y_LEDS; y++) { for (uint8_t y = 0; y < MAX7219_Y_LEDS; y++) {
if (val & mask) if (val & mask)
SET_PIXEL_7219(col, MAX7219_Y_LEDS-1-y); SET_PIXEL_7219(col, MAX7219_Y_LEDS-1-y);
else else
@ -235,7 +235,7 @@ void Max7219_Set_Column(const uint8_t col, const uint32_t val) {
#if _ROT == 90 || _ROT == 270 #if _ROT == 90 || _ROT == 270
SEND_7219(col); // force the column out to the Max7219 chips and strobe them SEND_7219(col); // force the column out to the Max7219 chips and strobe them
#else #else
for(uint8_t yy = 0; yy < 8; yy++) for (uint8_t yy = 0; yy < 8; yy++)
SEND_7219(yy); // force all columns out to the Max7219 chips and strobe them SEND_7219(yy); // force all columns out to the Max7219 chips and strobe them
#endif #endif
return; return;
@ -244,13 +244,13 @@ void Max7219_Set_Column(const uint8_t col, const uint32_t val) {
void Max7219_Clear_Column(const uint8_t col) { void Max7219_Clear_Column(const uint8_t col) {
if (col >= MAX7219_X_LEDS) return Max7219_Error(PSTR("Max7219_Clear_Column"), col); if (col >= MAX7219_X_LEDS) return Max7219_Error(PSTR("Max7219_Clear_Column"), col);
for(uint8_t yy = 0; yy < MAX7219_Y_LEDS; yy++) for (uint8_t yy = 0; yy < MAX7219_Y_LEDS; yy++)
CLEAR_PIXEL_7219(col, yy); CLEAR_PIXEL_7219(col, yy);
#if _ROT == 90 || _ROT == 270 #if _ROT == 90 || _ROT == 270
SEND_7219(col); // force the column out to the Max7219 chips and strobe them SEND_7219(col); // force the column out to the Max7219 chips and strobe them
#else #else
for(uint8_t y = 0; y < 8; y++) for (uint8_t y = 0; y < 8; y++)
SEND_7219(y); // force all columns out to the Max7219 chips and strobe them SEND_7219(y); // force all columns out to the Max7219 chips and strobe them
#endif #endif
return; return;
@ -322,22 +322,22 @@ void Max7219_Set_Columns_32bits(const uint8_t x, uint32_t val) {
void Max7219_register_setup() { void Max7219_register_setup() {
// Initialize the Max7219 // Initialize the Max7219
for(int i=0; i < MAX7219_NUMBER_UNITS; i++) for (uint8_t i = 0; i < MAX7219_NUMBER_UNITS; i++)
Max7219(max7219_reg_scanLimit, 0x07); Max7219(max7219_reg_scanLimit, 0x07);
Max7219_pulse_load(); // tell the chips to load the clocked out data Max7219_pulse_load(); // tell the chips to load the clocked out data
for(int i=0; i < MAX7219_NUMBER_UNITS; i++) for (uint8_t i = 0; i < MAX7219_NUMBER_UNITS; i++)
Max7219(max7219_reg_decodeMode, 0x00); // using an led matrix (not digits) Max7219(max7219_reg_decodeMode, 0x00); // using an led matrix (not digits)
Max7219_pulse_load(); // tell the chips to load the clocked out data Max7219_pulse_load(); // tell the chips to load the clocked out data
for(int i=0; i < MAX7219_NUMBER_UNITS; i++) for (uint8_t i = 0; i < MAX7219_NUMBER_UNITS; i++)
Max7219(max7219_reg_shutdown, 0x01); // not in shutdown mode Max7219(max7219_reg_shutdown, 0x01); // not in shutdown mode
Max7219_pulse_load(); // tell the chips to load the clocked out data Max7219_pulse_load(); // tell the chips to load the clocked out data
for(int i=0; i < MAX7219_NUMBER_UNITS; i++) for (uint8_t i = 0; i < MAX7219_NUMBER_UNITS; i++)
Max7219(max7219_reg_displayTest, 0x00); // no display test Max7219(max7219_reg_displayTest, 0x00); // no display test
Max7219_pulse_load(); // tell the chips to load the clocked out data Max7219_pulse_load(); // tell the chips to load the clocked out data
for(int i=0; i < MAX7219_NUMBER_UNITS; i++) for (uint8_t i = 0; i < MAX7219_NUMBER_UNITS; i++)
Max7219(max7219_reg_intensity, 0x01 & 0x0F); // the first 0x0F is the value you can set Max7219(max7219_reg_intensity, 0x01 & 0x0F); // the first 0x0F is the value you can set
// range: 0x00 to 0x0F // range: 0x00 to 0x0F
Max7219_pulse_load(); // tell the chips to load the clocked out data Max7219_pulse_load(); // tell the chips to load the clocked out data

View File

@ -110,7 +110,7 @@ void Max7219_idle_tasks();
#define SET_PIXEL_7219(x, y) LEDs[y + (x >> 3) * 8] |= _BV(7 - (x & 0x07)) #define SET_PIXEL_7219(x, y) LEDs[y + (x >> 3) * 8] |= _BV(7 - (x & 0x07))
#define CLEAR_PIXEL_7219(x, y) LEDs[y + (x >> 3) * 8] &= (_BV(7 - (x & 0x07)) ^ 0xff) #define CLEAR_PIXEL_7219(x, y) LEDs[y + (x >> 3) * 8] &= (_BV(7 - (x & 0x07)) ^ 0xff)
#define BIT_7219(x, y) TEST(LEDs[y + (x >> 3) * 8], 7 - (x & 0x07)) #define BIT_7219(x, y) TEST(LEDs[y + (x >> 3) * 8], 7 - (x & 0x07))
#define SEND_7219(R) do {for(int8_t jj = 0; jj < MAX7219_NUMBER_UNITS; jj++) Max7219(max7219_reg_digit0 + (R & 0x7), LEDs[(R & 0x7) + jj * 8]); Max7219_pulse_load(); } while (0); #define SEND_7219(R) do{ for (int8_t jj = 0; jj < MAX7219_NUMBER_UNITS; jj++) Max7219(max7219_reg_digit0 + (R & 0x7), LEDs[(R & 0x7) + jj * 8]); Max7219_pulse_load(); }while(0)
#elif _ROT == 90 #elif _ROT == 90
#define MAX7219_UPDATE_AXIS x // Fast line update axis for this orientation of the matrix display #define MAX7219_UPDATE_AXIS x // Fast line update axis for this orientation of the matrix display
#define MAX7219_X_LEDS 8 #define MAX7219_X_LEDS 8
@ -119,7 +119,7 @@ void Max7219_idle_tasks();
#define SET_PIXEL_7219(x, y) LEDs[x + (((MAX7219_Y_LEDS - 1 - y) >> 3) * 8)] |= _BV((y & 0x7)) #define SET_PIXEL_7219(x, y) LEDs[x + (((MAX7219_Y_LEDS - 1 - y) >> 3) * 8)] |= _BV((y & 0x7))
#define CLEAR_PIXEL_7219(x, y) LEDs[x + (((MAX7219_Y_LEDS - 1 - y) >> 3) * 8)] &= (_BV((y & 0x7)) ^ 0xff) #define CLEAR_PIXEL_7219(x, y) LEDs[x + (((MAX7219_Y_LEDS - 1 - y) >> 3) * 8)] &= (_BV((y & 0x7)) ^ 0xff)
#define BIT_7219(x, y) TEST(LEDs[x + (((MAX7219_Y_LEDS - 1 - y) >> 3) * 8)], (y & 0x7)) #define BIT_7219(x, y) TEST(LEDs[x + (((MAX7219_Y_LEDS - 1 - y) >> 3) * 8)], (y & 0x7))
#define SEND_7219(R) do {for(int8_t jj = 0; jj < MAX7219_NUMBER_UNITS; jj++) Max7219(max7219_reg_digit0 + (R & 0x7), LEDs[(R & 0x7) + jj * 8]); Max7219_pulse_load(); } while (0); #define SEND_7219(R) do{ for (int8_t jj = 0; jj < MAX7219_NUMBER_UNITS; jj++) Max7219(max7219_reg_digit0 + (R & 0x7), LEDs[(R & 0x7) + jj * 8]); Max7219_pulse_load(); }while(0)
#elif _ROT == 180 #elif _ROT == 180
#define MAX7219_UPDATE_AXIS y // Fast line update axis for this orientation of the matrix display #define MAX7219_UPDATE_AXIS y // Fast line update axis for this orientation of the matrix display
#define MAX7219_X_LEDS (8 * MAX7219_NUMBER_UNITS) #define MAX7219_X_LEDS (8 * MAX7219_NUMBER_UNITS)
@ -128,7 +128,7 @@ void Max7219_idle_tasks();
#define SET_PIXEL_7219(x, y) LEDs[y + ((MAX7219_X_LEDS - 1 - x) >> 3) * 8] |= _BV((x & 0x07)) #define SET_PIXEL_7219(x, y) LEDs[y + ((MAX7219_X_LEDS - 1 - x) >> 3) * 8] |= _BV((x & 0x07))
#define CLEAR_PIXEL_7219(x, y) LEDs[y + ((MAX7219_X_LEDS - 1 - x) >> 3) * 8] &= (_BV((x & 0x07)) ^ 0xff) #define CLEAR_PIXEL_7219(x, y) LEDs[y + ((MAX7219_X_LEDS - 1 - x) >> 3) * 8] &= (_BV((x & 0x07)) ^ 0xff)
#define BIT_7219(x, y) TEST(LEDs[y + ((MAX7219_X_LEDS - 1 - x) >> 3) * 8], ((x & 0x07))) #define BIT_7219(x, y) TEST(LEDs[y + ((MAX7219_X_LEDS - 1 - x) >> 3) * 8], ((x & 0x07)))
#define SEND_7219(R) do {for(int8_t jj = 0; jj < MAX7219_NUMBER_UNITS; jj++) Max7219(max7219_reg_digit7 - (R & 0x7), LEDs[(R & 0x7) + jj * 8]); Max7219_pulse_load(); } while (0); #define SEND_7219(R) do{ for (int8_t jj = 0; jj < MAX7219_NUMBER_UNITS; jj++) Max7219(max7219_reg_digit7 - (R & 0x7), LEDs[(R & 0x7) + jj * 8]); Max7219_pulse_load(); }while(0)
#elif _ROT == 270 #elif _ROT == 270
#define MAX7219_UPDATE_AXIS x // Fast line update axis for this orientation of the matrix display #define MAX7219_UPDATE_AXIS x // Fast line update axis for this orientation of the matrix display
#define MAX7219_X_LEDS 8 #define MAX7219_X_LEDS 8
@ -137,11 +137,11 @@ void Max7219_idle_tasks();
#define SET_PIXEL_7219(x, y) LEDs[x + (y >> 3) * 8] |= _BV(7 - (y & 0x7)) #define SET_PIXEL_7219(x, y) LEDs[x + (y >> 3) * 8] |= _BV(7 - (y & 0x7))
#define CLEAR_PIXEL_7219(x, y) LEDs[x + (y >> 3) * 8] &= (_BV(7 - (y & 0x7)) ^ 0xff) #define CLEAR_PIXEL_7219(x, y) LEDs[x + (y >> 3) * 8] &= (_BV(7 - (y & 0x7)) ^ 0xff)
#define BIT_7219(x, y) TEST(LEDs[x + ( y >> 3) * 8], 7 - (y & 0x7)) #define BIT_7219(x, y) TEST(LEDs[x + ( y >> 3) * 8], 7 - (y & 0x7))
#define SEND_7219(R) do {for(int8_t jj = 0; jj < MAX7219_NUMBER_UNITS; jj++) Max7219(max7219_reg_digit7 - (R & 0x7), LEDs[(R & 0x7) + jj * 8]); Max7219_pulse_load(); } while (0); #define SEND_7219(R) do{ for (int8_t jj = 0; jj < MAX7219_NUMBER_UNITS; jj++) Max7219(max7219_reg_digit7 - (R & 0x7), LEDs[(R & 0x7) + jj * 8]); Max7219_pulse_load(); }while(0)
#else #else
#error "MAX7219_ROTATE must be a multiple of +/- 90°." #error "MAX7219_ROTATE must be a multiple of +/- 90°."
#endif #endif
extern uint8_t LEDs[8*MAX7219_NUMBER_UNITS]; extern uint8_t LEDs[8 * MAX7219_NUMBER_UNITS];
#endif // __MAX7219_DEBUG_LEDS_H__ #endif // __MAX7219_DEBUG_LEDS_H__

View File

@ -399,7 +399,7 @@ bool Sd2Card::readBlock(uint32_t blockNumber, uint8_t* dst) {
#if ENABLED(SD_CHECK_AND_RETRY) #if ENABLED(SD_CHECK_AND_RETRY)
uint8_t retryCnt = 3; uint8_t retryCnt = 3;
for(;;) { for (;;) {
if (cardCommand(CMD17, blockNumber)) if (cardCommand(CMD17, blockNumber))
error(SD_CARD_ERROR_CMD17); error(SD_CARD_ERROR_CMD17);
else if (readData(dst, 512)) else if (readData(dst, 512))

View File

@ -395,7 +395,7 @@ void ST7920_Lite_Status_Screen::draw_degree_symbol(uint8_t x, uint8_t y, bool dr
const uint8_t x_word = x >> 1; const uint8_t x_word = x >> 1;
const uint8_t y_top = degree_symbol_y_top; const uint8_t y_top = degree_symbol_y_top;
const uint8_t y_bot = y_top + sizeof(degree_symbol)/sizeof(degree_symbol[0]); const uint8_t y_bot = y_top + sizeof(degree_symbol)/sizeof(degree_symbol[0]);
for(uint8_t i = y_top; i < y_bot; i++) { for (uint8_t i = y_top; i < y_bot; i++) {
uint8_t byte = pgm_read_byte_near(p_bytes++); uint8_t byte = pgm_read_byte_near(p_bytes++);
set_gdram_address(x_word,i+y*16); set_gdram_address(x_word,i+y*16);
begin_data(); begin_data();