Various general cleanups

Mostly from the L6470-oriented PR
This commit is contained in:
Scott Lahteine 2019-01-19 16:56:12 -06:00
parent 02cc63d6d4
commit ce563d7c2e
10 changed files with 21 additions and 21 deletions

View File

@ -120,14 +120,14 @@ static uint8_t buffer[256] = {0}, // The RAM buffer to accumulate writes
const uint8_t* c = (const uint8_t*) data;
char buffer[80];
sprintf(buffer, "Page: %d (0x%04x)\n", page, page);
sprintf_P(buffer, PSTR("Page: %d (0x%04x)\n"), page, page);
SERIAL_ECHO(buffer);
char* p = &buffer[0];
for (int i = 0; i< PageSize; ++i) {
if ((i & 0xF) == 0) p += sprintf(p,"%04x] ", i);
if ((i & 0xF) == 0) p += sprintf_P(p, PSTR("%04x] "), i);
p += sprintf(p," %02x", c[i]);
p += sprintf_P(p, PSTR(" %02x"), c[i]);
if ((i & 0xF) == 0xF) {
*p++ = '\n';
*p = 0;

View File

@ -71,7 +71,7 @@
#define GET_ARRAY_PIN(p) pin_array[p].pin
#define VALID_PIN(pin) (pin >= 0 && pin < (int8_t)NUMBER_PINS_TOTAL ? 1 : 0)
#define DIGITAL_PIN_TO_ANALOG_PIN(p) int(p - analogInputToDigitalPin(0))
#define IS_ANALOG(P) (((P) >= analogInputToDigitalPin(0)) && ((P) <= analogInputToDigitalPin(NUM_ANALOG_INPUTS - 1)))
#define IS_ANALOG(P) WITHIN(P, char(analogInputToDigitalPin(0)), char(analogInputToDigitalPin(NUM_ANALOG_INPUTS - 1)))
#define pwm_status(pin) (((g_pinStatus[pin] & 0xF) == PIN_STATUS_PWM) && \
((g_APinDescription[pin].ulPinAttribute & PIN_ATTR_PWM) == PIN_ATTR_PWM))
#define MULTI_NAME_PAD 14 // space needed to be pretty if not first name assigned to a pin

View File

@ -66,7 +66,7 @@ Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) {
#ifdef DEBUG_MMC
char buffer[80];
sprintf(buffer, "SDRD: %d @ 0x%08x\n", nb_sector, addr);
sprintf_P(buffer, PSTR("SDRD: %d @ 0x%08x\n"), nb_sector, addr);
SERIAL_ECHO_P(0, buffer);
#endif
@ -100,7 +100,7 @@ Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector) {
#ifdef DEBUG_MMC
char buffer[80];
sprintf(buffer, "SDWR: %d @ 0x%08x\n", nb_sector, addr);
sprintf_P(buffer, PSTR("SDWR: %d @ 0x%08x\n"), nb_sector, addr);
SERIAL_ECHO_P(0, buffer);
#endif

View File

@ -53,16 +53,16 @@
#define IS_ANALOG(P) ((P) >= analogInputToDigitalPin(0) && (P) <= analogInputToDigitalPin(9)) || ((P) >= analogInputToDigitalPin(12) && (P) <= analogInputToDigitalPin(20))
void HAL_print_analog_pin(char buffer[], int8_t pin) {
if (pin <= 23) sprintf(buffer, "(A%2d) ", int(pin - 14));
else if (pin <= 39) sprintf(buffer, "(A%2d) ", int(pin - 19));
if (pin <= 23) sprintf_P(buffer, PSTR("(A%2d) "), int(pin - 14));
else if (pin <= 39) sprintf_P(buffer, PSTR("(A%2d) "), int(pin - 19));
}
void HAL_analog_pin_state(char buffer[], int8_t pin) {
if (pin <= 23) sprintf(buffer, "Analog in =% 5d", analogRead(pin - 14));
else if (pin <= 39) sprintf(buffer, "Analog in =% 5d", analogRead(pin - 19));
if (pin <= 23) sprintf_P(buffer, PSTR("Analog in =% 5d"), analogRead(pin - 14));
else if (pin <= 39) sprintf_P(buffer, PSTR("Analog in =% 5d"), analogRead(pin - 19));
}
#define PWM_PRINT(V) do{ sprintf(buffer, "PWM: %4d", 22); SERIAL_ECHO(buffer); }while(0)
#define PWM_PRINT(V) do{ sprintf_P(buffer, PSTR("PWM: %4d"), 22); SERIAL_ECHO(buffer); }while(0)
#define FTM_CASE(N,Z) \
case FTM##N##_CH##Z##_PIN: \
if (FTM##N##_C##Z##V) { \

View File

@ -1788,10 +1788,8 @@
#define USER_DESC_1 "Test Print"
#define USER_GCODE_1 "G28\nG29\nG26"
/*
#define USER_DESC_1 "Home & UBL Info"
#define USER_GCODE_1 "G28\nG29 W"
/*
#define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL
#define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND)
@ -1803,7 +1801,7 @@
#define USER_DESC_5 "Home & Info"
#define USER_GCODE_5 "G28\nM503"
*/
*/
#endif
/**

View File

@ -56,9 +56,7 @@
#define NANOSECONDS_PER_CYCLE (1000000000.0 / F_CPU)
// Remove compiler warning on an unused variable
#if !defined(ARDUINO_ARCH_STM32) || defined(STM32GENERIC)
#define UNUSED(x) ((void)(x))
#endif
#define UNUSED(x) ((void)(x))
// Macros to make a string from a macro
#define STRINGIFY_(M) #M

View File

@ -54,7 +54,8 @@ void GcodeSuite::M302() {
else if (!seen_S) {
// Report current state
SERIAL_ECHO_START();
SERIAL_ECHOPAIR("Cold extrudes are ", (thermalManager.allow_cold_extrude ? "en" : "dis"));
SERIAL_ECHOPGM("Cold extrudes are ");
serialprintPGM(thermalManager.allow_cold_extrude ? PSTR("en") : PSTR("dis"));
SERIAL_ECHOPAIR("abled (min temp ", thermalManager.extrude_min_temp);
SERIAL_ECHOLNPGM("C)");
}

View File

@ -110,7 +110,7 @@ bool Sd2Card::init(const uint8_t sckRateID/*=0*/, const pin_t chipSelectPin/*=SD
const uint32_t sectorSize = bulk.GetSectorSize(0);
if (sectorSize != 512) {
SERIAL_ECHOLNPAIR("Expecting sector size of 512, got:", sectorSize);
SERIAL_ECHOLNPAIR("Expecting sector size of 512. Got: ", sectorSize);
return false;
}

View File

@ -127,7 +127,7 @@ bool MAX3421e::start() {
const uint8_t revision = regRd(rREVISION);
if (revision == 0x00 || revision == 0xFF) {
SERIAL_ECHOLNPAIR("Revision register appears incorrect on MAX3421e initialization, got ", revision);
SERIAL_ECHOLNPAIR("Revision register appears incorrect on MAX3421e initialization. Got ", revision);
return false;
}

View File

@ -105,6 +105,7 @@ current_OS = platform.system()
target_env = ''
board_name = ''
from datetime import datetime, date, time
#########
# Python 2 error messages:
@ -892,6 +893,8 @@ def run_PIO(dummy):
write_to_screen_queue('\nBoard name: ' + board_name + '\n') # put build info at the bottom of the screen
write_to_screen_queue('Build type: ' + build_type + '\n')
write_to_screen_queue('Environment used: ' + target_env + '\n')
write_to_screen_queue(str(datetime.now()) + '\n')
# end - run_PIO