Fix various errors, warnings in example config builds (#19686)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
Jason Smith 2020-10-11 17:06:57 -07:00 committed by Scott Lahteine
parent 2c7b5fe1f2
commit 8b4f82cd07
11 changed files with 141 additions and 165 deletions

View File

@ -511,11 +511,9 @@ void GcodeSuite::G26() {
g26_keep_heaters_on = parser.boolval('K');
// Accept 'I' if temperature presets are defined
const uint8_t preset_index = (0
#if PREHEAT_COUNT
+ (parser.seenval('I') ? _MIN(parser.value_byte(), PREHEAT_COUNT - 1) + 1 : 0)
const uint8_t preset_index = parser.seenval('I') ? _MIN(parser.value_byte(), PREHEAT_COUNT - 1) + 1 : 0;
#endif
);
#if HAS_HEATED_BED

View File

@ -127,7 +127,7 @@ void GcodeSuite::M290() {
#else
PSTR("Babystep Z")
#endif
, babystep.axis_total[BS_AXIS_IND(Z_AXIS)]
, babystep.axis_total[BS_TOTAL_IND(Z_AXIS)]
);
}
#endif

View File

@ -1341,7 +1341,7 @@
#undef STATUS_LOGO_WIDTH
#endif
#if (HAS_MULTI_HOTEND && STATUS_LOGO_WIDTH && BED_OR_CHAMBER_OR_FAN) || (HOTENDS >= 3 && !BED_OR_CHAMBER_OR_FAN)
#if !defined(STATUS_HEATERS_X) && ((HAS_MULTI_HOTEND && STATUS_LOGO_WIDTH && BED_OR_CHAMBER_OR_FAN) || (HOTENDS >= 3 && !BED_OR_CHAMBER_OR_FAN))
#define _STATUS_HEATERS_X(H,S,N) ((LCD_PIXEL_WIDTH - (H * (S + N)) - (_EXTRA_WIDTH) + (STATUS_LOGO_WIDTH)) / 2)
#if STATUS_HOTEND1_WIDTH
#if HOTENDS > 2

View File

@ -46,7 +46,8 @@
extern lv_group_t * g;
static lv_obj_t * scr;
static lv_obj_t *labelExt1, * labelExt2, * labelFan, * labelZpos, * labelTime;
static lv_obj_t *labelExt1, * labelFan, * labelZpos, * labelTime;
TERN_(HAS_MULTI_EXTRUDER, static lv_obj_t *labelExt2;)
static lv_obj_t *labelPause, * labelStop, * labelOperat;
static lv_obj_t * bar1, *bar1ValueText;
static lv_obj_t * buttonPause, *buttonOperat, *buttonStop;
@ -137,9 +138,6 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
}
void lv_draw_printing(void) {
lv_obj_t *buttonExt1, *buttonExt2, *buttonFanstate, *buttonZpos, *buttonTime;
TERN_(HAS_HEATED_BED, lv_obj_t * buttonBedstate);
disp_state_stack._disp_index = 0;
ZERO(disp_state_stack._disp_state);
disp_state_stack._disp_state[disp_state_stack._disp_index] = PRINTING_UI;
@ -162,16 +160,16 @@ void lv_draw_printing(void) {
lv_refr_now(lv_refr_get_disp_refreshing());
// Create image buttons
buttonExt1 = lv_img_create(scr, NULL);
lv_obj_t *buttonExt1 = lv_img_create(scr, NULL);
#if HAS_MULTI_EXTRUDER
buttonExt2 = lv_img_create(scr, NULL);
lv_obj_t *buttonExt2 = lv_img_create(scr, NULL);
#endif
#if HAS_HEATED_BED
buttonBedstate = lv_img_create(scr, NULL);
lv_obj_t *buttonBedstate = lv_img_create(scr, NULL);
#endif
buttonFanstate = lv_img_create(scr, NULL);
buttonTime = lv_img_create(scr, NULL);
buttonZpos = lv_img_create(scr, NULL);
lv_obj_t *buttonFanstate = lv_img_create(scr, NULL);
lv_obj_t *buttonTime = lv_img_create(scr, NULL);
lv_obj_t *buttonZpos = lv_img_create(scr, NULL);
buttonPause = lv_imgbtn_create(scr, NULL);
buttonStop = lv_imgbtn_create(scr, NULL);
buttonOperat = lv_imgbtn_create(scr, NULL);

View File

@ -799,13 +799,14 @@ void lv_encoder_pin_init() {
//static const int8_t encoderDirection = 1;
//static int16_t enc_Direction;
void lv_update_encoder() {
static uint8_t buttons;
static uint32_t encoder_time1;
uint32_t tmpTime, diffTime = 0;
tmpTime = millis();
diffTime = getTickDiff(tmpTime, encoder_time1);
if (diffTime > 50) {
#if HAS_ENCODER_WHEEL
#if ANY_BUTTON(EN1, EN2, ENC, BACK)
uint8_t newbutton = 0;
@ -829,9 +830,8 @@ void lv_encoder_pin_init() {
#endif
buttons = newbutton;
#if HAS_ENCODER_WHEEL
static uint8_t buttons = newbutton;
static uint8_t lastEncoderBits;
#define encrot0 0

View File

@ -110,23 +110,16 @@ const char *resultMessages[] = {
// 230400b always manages to connect.
static const uint32_t uploadBaudRates[] = { 460800, 230400, 115200, 74880 };
signed char IsReady() {
return esp_upload.state == upload_idle;
}
void uploadPort_write(const uint8_t *buf, size_t len) {
#if 0
int i;
for(i = 0; i < len; i++) {
while (USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET);
for (i = 0; i < len; i++) {
while (USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET) { /* nada */ }
USART_SendData(USART1, *(buf + i));
}
#endif
@ -138,28 +131,22 @@ char uploadPort_read() {
return retChar;
else
return 0;
}
int uploadPort_available() {
return usartFifoAvailable(&WifiRxFifo);
}
void uploadPort_begin() {
esp_port_begin(1);
}
void uploadPort_close() {
//WIFI_COM.end();
//WIFI_COM.begin(115200, true);
esp_port_begin(0);
}
void flushInput() {
while (uploadPort_available() != 0) {
(void)uploadPort_read();
@ -304,7 +291,6 @@ EspUploadResult readPacket(uint8_t op, uint32_t *valp, size_t *bodyLen, uint32_t
*bodyLen = 0;
while (state != done) {
uint8_t c;
EspUploadResult stat;
@ -322,7 +308,7 @@ EspUploadResult readPacket(uint8_t op, uint32_t *valp, size_t *bodyLen, uint32_t
}
// sufficient bytes have been received for the current state, process them
switch(state) {
switch (state) {
case begin: // expecting frame start
c = uploadPort_read();
if (c != (uint8_t)0xC0) {
@ -397,7 +383,7 @@ EspUploadResult readPacket(uint8_t op, uint32_t *valp, size_t *bodyLen, uint32_t
opRet = (uint8_t)getData(1, hdr, 1);
// Sync packets often provoke a response with a zero opcode instead of ESP_SYNC
if (resp != 0x01 || opRet != op) {
//debug//printf("resp %02x %02x\n", resp, opRet);
//printf("resp %02x %02x\n", resp, opRet); //debug
return respHeader;
}
@ -432,7 +418,6 @@ void _writePacket(const uint8_t *data, size_t len) {
// 0xC0 and 0xDB replaced by the two-byte sequences {0xDB, 0xDC} and {0xDB, 0xDD} respectively.
void writePacket(const uint8_t *hdr, size_t hdrLen, const uint8_t *data, size_t dataLen) {
WriteByteRaw(0xC0); // send the packet start character
_writePacket(hdr, hdrLen); // send the header
_writePacket(data, dataLen); // send the data block
@ -460,12 +445,10 @@ void sendCommand(uint8_t op, uint32_t checkVal, const uint8_t *data, size_t data
// send the packet
//flushInput();
if (op == ESP_SYNC) {
if (op == ESP_SYNC)
writePacketRaw(hdr, sizeof(hdr), data, dataLen);
}
else {
else
writePacket(hdr, sizeof(hdr), data, dataLen);
}
}
// Send a command to the attached device together with the supplied data, if any, and get the response
@ -476,9 +459,8 @@ EspUploadResult doCommand(uint8_t op, const uint8_t *data, size_t dataLen, uint3
sendCommand(op, checkVal, data, dataLen);
stat = readPacket(op, valp, &bodyLen, msTimeout);
if (stat == success && bodyLen != 2) {
if (stat == success && bodyLen != 2)
stat = badReply;
}
return stat;
}
@ -611,6 +593,8 @@ EspUploadResult flashWriteBlock(uint16_t flashParmVal, uint16_t flashParmMask) {
//printf("Upload %d\%\n", ftell(&esp_upload.uploadFile) * 100 / esp_upload.fileSize);
return stat;
#else
return success;
#endif
}
@ -625,15 +609,14 @@ void upload_spin() {
esp_upload.uploadResult = connected;
esp_upload.state = done;
}
else{
else {
// Reset the serial port at the new baud rate. Also reset the ESP8266.
// const uint32_t baud = uploadBaudRates[esp_upload.connectAttemptNumber/esp_upload.retriesPerBaudRate];
if (esp_upload.connectAttemptNumber % esp_upload.retriesPerBaudRate == 0) {
}
// uploadPort.begin(baud);
// uploadPort_close();
//uploadPort.begin(baud);
//uploadPort_close();
uploadPort_begin();
@ -654,7 +637,7 @@ void upload_spin() {
esp_upload.lastAttemptTime = getWifiTick();
if (res == success) {
// Successful connection
// //MessageF(" success on attempt %d\n", (connectAttemptNumber % retriesPerBaudRate) + 1);
//MessageF(" success on attempt %d\n", (connectAttemptNumber % retriesPerBaudRate) + 1);
//printf("connect success\n");
esp_upload.state = erasing;
}
@ -675,11 +658,10 @@ void upload_spin() {
const uint32_t sectorSize = 4096;
const uint32_t numSectors = (esp_upload.fileSize + sectorSize - 1)/sectorSize;
const uint32_t startSector = esp_upload.uploadAddress/sectorSize;
uint32_t headSectors = sectorsPerBlock - (startSector % sectorsPerBlock);
if (numSectors < headSectors) {
headSectors = numSectors;
}
uint32_t headSectors = sectorsPerBlock - (startSector % sectorsPerBlock);
NOMORE(headSectors, numSectors);
eraseSize = (numSectors < 2 * headSectors)
? (numSectors + 1) / 2 * sectorSize
: (numSectors - headSectors) * sectorSize;

View File

@ -118,7 +118,7 @@ void lcd_delta_settings() {
}
void menu_delta_calibrate() {
const bool all_homed = all_axes_homed();
TERN_(DELTA_CALIBRATION_MENU, const bool all_homed = all_axes_homed()); // Acquire ahead of loop
START_MENU();
BACK_ITEM(MSG_MAIN);

View File

@ -188,11 +188,10 @@ void _lcd_ubl_edit_mesh() {
*/
void _lcd_ubl_validate_custom_mesh() {
char ubl_lcd_gcode[24];
const int16_t temp = TERN(HAS_HEATED_BED, custom_bed_temp, 0);
sprintf_P(ubl_lcd_gcode, PSTR("G28\nG26 C P H%" PRIi16 TERN_(HAS_HEATED_BED, " B%" PRIi16))
, custom_hotend_temp
#if HAS_HEATED_BED
, temp
, custom_bed_temp
#endif
);
queue.inject(ubl_lcd_gcode);

View File

@ -33,8 +33,7 @@
* B: 0.00031362
* C: -2.03978e-07
*/
#define NUMTEMPS 61
const short temptable_666[NUMTEMPS][2] PROGMEM = {
const temp_entry_t temptable_666[] PROGMEM = {
{ OV( 1), 794 },
{ OV( 18), 288 },
{ OV( 35), 234 },

View File

@ -608,12 +608,6 @@
#define _Z_PROBE
#endif
#if TEMP_SENSOR_BED && PIN_EXISTS(HEATER_BED)
#define _HEATER_BED HEATER_BED_PIN,
#else
#define _HEATER_BED
#endif
#if PIN_EXISTS(FAN)
#define _FAN0 FAN_PIN,
#else
@ -660,21 +654,26 @@
#define _FANC
#endif
#if PIN_EXISTS(HEATER_BED) && PIN_EXISTS(TEMP_BED)
#if TEMP_SENSOR_BED && PINS_EXIST(TEMP_BED, HEATER_BED)
#define _BED_PINS HEATER_BED_PIN, analogInputToDigitalPin(TEMP_BED_PIN),
#else
#define _BED_PINS
#endif
#if PIN_EXISTS(TEMP_CHAMBER)
#define __CHAMBER_PINS CHAMBER_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_CHAMBER_PIN),
#if TEMP_SENSOR_CHAMBER && PIN_EXISTS(TEMP_CHAMBER)
#define _CHAMBER_TEMP analogInputToDigitalPin(TEMP_CHAMBER_PIN),
#else
#define __CHAMBER_PINS
#define _CHAMBER_TEMP
#endif
#if PIN_EXISTS(HEATER_CHAMBER)
#define _CHAMBER_PINS __CHAMBER_PINS HEATER_CHAMBER_PIN,
#if TEMP_SENSOR_CHAMBER && PINS_EXIST(TEMP_CHAMBER, HEATER_CHAMBER)
#define _CHAMBER_HEATER HEATER_CHAMBER_PIN,
#else
#define _CHAMBER_PINS
#define _CHAMBER_HEATER
#endif
#if TEMP_SENSOR_CHAMBER && PINS_EXIST(TEMP_CHAMBER, CHAMBER_AUTO_FAN)
#define _CHAMBER_FAN CHAMBER_AUTO_FAN_PIN,
#else
#define _CHAMBER_FAN
#endif
#ifndef HAL_SENSITIVE_PINS
@ -685,6 +684,6 @@
_X_PINS _Y_PINS _Z_PINS _X2_PINS _Y2_PINS _Z2_PINS _Z3_PINS _Z4_PINS _Z_PROBE \
_E0_PINS _E1_PINS _E2_PINS _E3_PINS _E4_PINS _E5_PINS _E6_PINS _E7_PINS \
_H0_PINS _H1_PINS _H2_PINS _H3_PINS _H4_PINS _H5_PINS _H6_PINS _H7_PINS \
_PS_ON _HEATER_BED _FAN0 _FAN1 _FAN2 _FAN3 _FAN4 _FAN5 _FAN6 _FAN7 _FANC \
_BED_PINS _CHAMBER_PINS HAL_SENSITIVE_PINS \
_PS_ON _FAN0 _FAN1 _FAN2 _FAN3 _FAN4 _FAN5 _FAN6 _FAN7 _FANC \
_BED_PINS _CHAMBER_TEMP _CHAMBER_HEATER _CHAMBER_FAN HAL_SENSITIVE_PINS \
}

View File

@ -200,6 +200,7 @@
#elif SD_CONNECTION_IS(ONBOARD)
#define SDIO_SUPPORT
#define SD_DETECT_PIN PD12
#define ONBOARD_SD_CS_PIN PC11
#elif SD_CONNECTION_IS(CUSTOM_CABLE)
#error "No custom SD drive cable defined for this board."
#endif