Fix some warnings, Melzi pins

This commit is contained in:
Jason Smith 2020-01-14 23:55:26 -08:00 committed by Scott Lahteine
parent b310047ded
commit c305c2cc6b
9 changed files with 134 additions and 58 deletions

View File

@ -68,7 +68,7 @@ void dac_current_percent(uint8_t channel, float val) {
void dac_current_raw(uint8_t channel, uint16_t val) {
if (!dac_present) return;
NOMORE(val, DAC_STEPPER_MAX);
NOMORE(val, uint16_t(DAC_STEPPER_MAX));
mcp4728_analogWrite(dac_order[channel], val);
mcp4728_simpleCommand(UPDATE);

View File

@ -1395,7 +1395,7 @@ void Planner::check_axes_activity() {
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
const float fade_scaling_factor = fade_scaling_factor_for_z(raw.z);
#else
#elif DISABLED(MESH_BED_LEVELING)
constexpr float fade_scaling_factor = 1.0;
#endif
@ -1432,7 +1432,7 @@ void Planner::check_axes_activity() {
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
const float fade_scaling_factor = fade_scaling_factor_for_z(raw.z);
#else
#elif DISABLED(MESH_BED_LEVELING)
constexpr float fade_scaling_factor = 1.0;
#endif

View File

@ -2912,6 +2912,7 @@ void Temperature::tick() {
) {
#if TEMP_RESIDENCY_TIME > 0
millis_t residency_start_ms = 0;
bool first_loop = true;
// Loop until the temperature has stabilized
#define TEMP_CONDITIONS (!residency_start_ms || PENDING(now, residency_start_ms + (TEMP_RESIDENCY_TIME) * 1000UL))
#else
@ -2929,7 +2930,7 @@ void Temperature::tick() {
#endif
float target_temp = -1.0, old_temp = 9999.0;
bool wants_to_cool = false, first_loop = true;
bool wants_to_cool = false;
wait_for_heatup = true;
millis_t now, next_temp_ms = 0, next_cool_check_ms = 0;
do {
@ -2982,6 +2983,8 @@ void Temperature::tick() {
residency_start_ms = now;
}
first_loop = false;
#endif
// Prevent a wait-forever situation if R is misused i.e. M109 R0
@ -3002,8 +3005,6 @@ void Temperature::tick() {
}
#endif
first_loop = false;
} while (wait_for_heatup && TEMP_CONDITIONS);
if (wait_for_heatup) {
@ -3151,6 +3152,7 @@ void Temperature::tick() {
bool Temperature::wait_for_chamber(const bool no_wait_for_cooling/*=true*/) {
#if TEMP_CHAMBER_RESIDENCY_TIME > 0
millis_t residency_start_ms = 0;
bool first_loop = true;
// Loop until the temperature has stabilized
#define TEMP_CHAMBER_CONDITIONS (!residency_start_ms || PENDING(now, residency_start_ms + (TEMP_CHAMBER_RESIDENCY_TIME) * 1000UL))
#else
@ -3159,7 +3161,7 @@ void Temperature::tick() {
#endif
float target_temp = -1, old_temp = 9999;
bool wants_to_cool = false, first_loop = true;
bool wants_to_cool = false;
wait_for_heatup = true;
millis_t now, next_temp_ms = 0, next_cool_check_ms = 0;
@ -3212,6 +3214,7 @@ void Temperature::tick() {
residency_start_ms = now;
}
first_loop = false;
#endif // TEMP_CHAMBER_RESIDENCY_TIME > 0
// Prevent a wait-forever situation if R is misused i.e. M191 R0
@ -3224,9 +3227,6 @@ void Temperature::tick() {
old_temp = temp;
}
}
first_loop = false;
} while (wait_for_heatup && TEMP_CHAMBER_CONDITIONS);
if (wait_for_heatup) ui.reset_status();

View File

@ -1,3 +1,26 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
/**
* CartesioV11 pin assignments
*/

View File

@ -1,3 +1,26 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
/**
* CartesioV12 pin assignments
*/

View File

@ -1,3 +1,26 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
/**
* CNControls V15 for HMS434 pin assignments
*/
@ -64,7 +87,7 @@
//
// Fans
//
#define FAN0_PIN 8
#define FAN_PIN 8
#define ORIG_E0_AUTO_FAN_PIN 30
#define ORIG_E1_AUTO_FAN_PIN 30
#define ORIG_E2_AUTO_FAN_PIN 30

View File

@ -508,7 +508,9 @@
#ifndef SD_DETECT_PIN
#define SD_DETECT_PIN 49
#endif
#ifndef KILL_PIN
#define KILL_PIN 41
#endif
#if ENABLED(BQ_LCD_SMART_CONTROLLER)
#define LCD_BACKLIGHT_PIN 39

View File

@ -156,9 +156,21 @@
//
#if HAS_SPI_LCD
#define SD_DETECT_PIN -1
#if HAS_GRAPHICAL_LCD
#if ENABLED(U8GLIB_ST7920) // SPI GLCD 12864 ST7920 ( like [www.digole.com] ) For Melzi V2.0
#if ENABLED(LCD_FOR_MELZI)
#define LCD_PINS_RS 17
#define LCD_PINS_ENABLE 16
#define LCD_PINS_D4 11
#define BOARD_ST7920_DELAY_1 DELAY_NS(0)
#define BOARD_ST7920_DELAY_2 DELAY_NS(188)
#define BOARD_ST7920_DELAY_3 DELAY_NS(0)
#elif ENABLED(U8GLIB_ST7920) // SPI GLCD 12864 ST7920 ( like [www.digole.com] ) For Melzi V2.0
#if IS_MELZI
#define LCD_PINS_RS 30 // CS chip select /SS chip slave select
@ -177,7 +189,7 @@
#define LCD_PINS_D7 27
#endif
#else // DOGM SPI LCD Support
#else
#define DOGLCD_A0 30
@ -201,44 +213,11 @@
#endif
// Uncomment screen orientation
#define LCD_SCREEN_ROT_0
//#define LCD_SCREEN_ROT_0
//#define LCD_SCREEN_ROT_90
//#define LCD_SCREEN_ROT_180
//#define LCD_SCREEN_ROT_270
#else // !HAS_GRAPHICAL_LCD
#define LCD_PINS_RS 4
#define LCD_PINS_ENABLE 17
#define LCD_PINS_D4 30
#define LCD_PINS_D5 29
#define LCD_PINS_D6 28
#define LCD_PINS_D7 27
#endif // !HAS_GRAPHICAL_LCD
#if ENABLED(LCD_I2C_PANELOLU2)
#if IS_MELZI
#define BTN_ENC 29
#define LCD_SDSS 30 // Panelolu2 SD card reader rather than the Melzi
#else
#define BTN_ENC 30
#endif
#elif ENABLED(LCD_FOR_MELZI)
#define LCD_PINS_RS 17
#define LCD_PINS_ENABLE 16
#define LCD_PINS_D4 11
#define BTN_ENC 28
#define BTN_EN1 29
#define BTN_EN2 30
#define BOARD_ST7920_DELAY_1 DELAY_NS(0)
#define BOARD_ST7920_DELAY_2 DELAY_NS(188)
#define BOARD_ST7920_DELAY_3 DELAY_NS(0)
#elif ENABLED(ZONESTAR_LCD) // For the Tronxy Melzi boards
#define LCD_PINS_RS 28
@ -247,12 +226,40 @@
#define LCD_PINS_D5 11
#define LCD_PINS_D6 16
#define LCD_PINS_D7 17
#define ADC_KEYPAD_PIN 1
#else
#define LCD_PINS_RS 4
#define LCD_PINS_ENABLE 17
#define LCD_PINS_D4 30
#define LCD_PINS_D5 29
#define LCD_PINS_D6 28
#define LCD_PINS_D7 27
#endif
#if ENABLED(LCD_FOR_MELZI)
#define BTN_ENC 28
#define BTN_EN1 29
#define BTN_EN2 30
#elif ENABLED(ZONESTAR_LCD) // For the Tronxy Melzi boards
#define ADC_KEYPAD_PIN 1
#define BTN_EN1 -1
#define BTN_EN2 -1
#else // !LCD_I2C_PANELOLU2 && !LCD_FOR_MELZI && !ZONESTAR_LCD
#elif ENABLED(LCD_I2C_PANELOLU2)
#if IS_MELZI
#define BTN_ENC 29
#define LCD_SDSS 30 // Panelolu2 SD card reader rather than the Melzi
#else
#define BTN_ENC 30
#endif
#else // !LCD_FOR_MELZI && !ZONESTAR_LCD && !LCD_I2C_PANELOLU2
#define BTN_ENC 16
#define LCD_SDSS 28 // Smart Controller SD card reader rather than the Melzi
@ -264,8 +271,6 @@
#define BTN_EN2 10
#endif
#define SD_DETECT_PIN -1
#endif // HAS_SPI_LCD
//

View File

@ -678,7 +678,7 @@ void CardReader::selectFileByIndex(const uint16_t nr) {
//
void CardReader::selectFileByName(const char * const match) {
#if ENABLED(SDSORT_CACHE_NAMES)
for (int nr = 0; nr < sort_count; nr++)
for (uint16_t nr = 0; nr < sort_count; nr++)
if (strcasecmp(match, sortshort[nr]) == 0) {
strcpy(filename, sortshort[nr]);
strcpy(longFilename, sortnames[nr]);