Optimize G-code / feature dependencies (#18919)
This commit is contained in:
@ -189,7 +189,7 @@
|
||||
#include "feature/leds/tempstat.h"
|
||||
#endif
|
||||
|
||||
#if HAS_CASE_LIGHT
|
||||
#if ENABLED(CASE_LIGHT_ENABLE)
|
||||
#include "feature/caselight.h"
|
||||
#endif
|
||||
|
||||
@ -1082,11 +1082,11 @@ void setup() {
|
||||
OUT_WRITE(STAT_LED_BLUE_PIN, LOW); // OFF
|
||||
#endif
|
||||
|
||||
#if HAS_CASE_LIGHT
|
||||
#if ENABLED(CASE_LIGHT_ENABLE)
|
||||
#if DISABLED(CASE_LIGHT_USE_NEOPIXEL)
|
||||
if (PWM_PIN(CASE_LIGHT_PIN)) SET_PWM(CASE_LIGHT_PIN); else SET_OUTPUT(CASE_LIGHT_PIN);
|
||||
#endif
|
||||
SETUP_RUN(update_case_light());
|
||||
SETUP_RUN(caselight.update_brightness());
|
||||
#endif
|
||||
|
||||
#if ENABLED(MK2_MULTIPLEXER)
|
||||
|
@ -25,7 +25,7 @@
|
||||
#if ENABLED(BINARY_FILE_TRANSFER)
|
||||
|
||||
#include "../sd/cardreader.h"
|
||||
#include "binary_protocol.h"
|
||||
#include "binary_stream.h"
|
||||
|
||||
char* SDFileTransferProtocol::Packet::Open::data = nullptr;
|
||||
size_t SDFileTransferProtocol::data_waiting, SDFileTransferProtocol::transfer_timeout, SDFileTransferProtocol::idle_timeout;
|
||||
@ -33,4 +33,4 @@ bool SDFileTransferProtocol::transfer_active, SDFileTransferProtocol::dummy_tran
|
||||
|
||||
BinaryStream binaryStream[NUM_SERIAL];
|
||||
|
||||
#endif // BINARY_FILE_TRANSFER
|
||||
#endif
|
@ -22,14 +22,17 @@
|
||||
|
||||
#include "../inc/MarlinConfig.h"
|
||||
|
||||
#if HAS_CASE_LIGHT
|
||||
#if ENABLED(CASE_LIGHT_ENABLE)
|
||||
|
||||
uint8_t case_light_brightness = CASE_LIGHT_DEFAULT_BRIGHTNESS;
|
||||
bool case_light_on = CASE_LIGHT_DEFAULT_ON;
|
||||
#include "caselight.h"
|
||||
|
||||
CaseLight caselight;
|
||||
|
||||
uint8_t CaseLight::brightness = CASE_LIGHT_DEFAULT_BRIGHTNESS;
|
||||
bool CaseLight::on = CASE_LIGHT_DEFAULT_ON;
|
||||
|
||||
#if ENABLED(CASE_LIGHT_USE_NEOPIXEL)
|
||||
#include "leds/leds.h"
|
||||
LEDColor case_light_color =
|
||||
LEDColor CaseLight::color =
|
||||
#ifdef CASE_LIGHT_NEOPIXEL_COLOR
|
||||
CASE_LIGHT_NEOPIXEL_COLOR
|
||||
#else
|
||||
@ -38,34 +41,33 @@ bool case_light_on = CASE_LIGHT_DEFAULT_ON;
|
||||
;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The following are needed because ARM chips ignore a "WRITE(CASE_LIGHT_PIN,x)" command to the pins that
|
||||
* are directly controlled by the PWM module. In order to turn them off the brightness level needs to be
|
||||
* set to off. Since we can't use the pwm register to save the last brightness level we need a variable
|
||||
* to save it.
|
||||
*/
|
||||
uint8_t case_light_brightness_sav; // saves brighness info so can restore when "M355 S1" received
|
||||
bool case_light_arg_flag; // flag to notify if S or P argument type
|
||||
|
||||
#ifndef INVERT_CASE_LIGHT
|
||||
#define INVERT_CASE_LIGHT false
|
||||
#endif
|
||||
|
||||
void update_case_light() {
|
||||
void CaseLight::update(const bool sflag) {
|
||||
/**
|
||||
* The brightness_sav (and sflag) is needed because ARM chips ignore
|
||||
* a "WRITE(CASE_LIGHT_PIN,x)" command to the pins that are directly
|
||||
* controlled by the PWM module. In order to turn them off the brightness
|
||||
* level needs to be set to OFF. Since we can't use the PWM register to
|
||||
* save the last brightness level we need a variable to save it.
|
||||
*/
|
||||
static uint8_t brightness_sav; // Save brightness info for restore on "M355 S1"
|
||||
|
||||
if (!(case_light_arg_flag && !case_light_on))
|
||||
case_light_brightness_sav = case_light_brightness; // save brightness except if this is an S0 argument
|
||||
if (case_light_arg_flag && case_light_on)
|
||||
case_light_brightness = case_light_brightness_sav; // restore last brightens if this is an S1 argument
|
||||
if (on || !sflag)
|
||||
brightness_sav = brightness; // Save brightness except for M355 S0
|
||||
if (sflag && on)
|
||||
brightness = brightness_sav; // Restore last brightness for M355 S1
|
||||
|
||||
#if ENABLED(CASE_LIGHT_USE_NEOPIXEL) || DISABLED(CASE_LIGHT_NO_BRIGHTNESS)
|
||||
const uint8_t i = case_light_on ? case_light_brightness : 0, n10ct = INVERT_CASE_LIGHT ? 255 - i : i;
|
||||
const uint8_t i = on ? brightness : 0, n10ct = INVERT_CASE_LIGHT ? 255 - i : i;
|
||||
#endif
|
||||
|
||||
#if ENABLED(CASE_LIGHT_USE_NEOPIXEL)
|
||||
|
||||
leds.set_color(
|
||||
MakeLEDColor(case_light_color.r, case_light_color.g, case_light_color.b, case_light_color.w, n10ct),
|
||||
MakeLEDColor(color.r, color.g, color.b, color.w, n10ct),
|
||||
false
|
||||
);
|
||||
|
||||
@ -83,11 +85,11 @@ void update_case_light() {
|
||||
else
|
||||
#endif
|
||||
{
|
||||
const bool s = case_light_on ? !INVERT_CASE_LIGHT : INVERT_CASE_LIGHT;
|
||||
const bool s = on ? !INVERT_CASE_LIGHT : INVERT_CASE_LIGHT;
|
||||
WRITE(CASE_LIGHT_PIN, s ? HIGH : LOW);
|
||||
}
|
||||
|
||||
#endif // !CASE_LIGHT_USE_NEOPIXEL
|
||||
}
|
||||
|
||||
#endif // HAS_CASE_LIGHT
|
||||
#endif // CASE_LIGHT_ENABLE
|
||||
|
@ -21,9 +21,25 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
extern uint8_t case_light_brightness;
|
||||
extern bool case_light_on;
|
||||
extern uint8_t case_light_brightness_sav; // saves brighness info when case_light_on is false
|
||||
extern bool case_light_arg_flag; // flag to notify if S or P argument type
|
||||
#include "../inc/MarlinConfigPre.h"
|
||||
|
||||
void update_case_light();
|
||||
#if ENABLED(CASE_LIGHT_USE_NEOPIXEL)
|
||||
#include "leds/leds.h"
|
||||
#endif
|
||||
|
||||
class CaseLight {
|
||||
public:
|
||||
static uint8_t brightness;
|
||||
static bool on;
|
||||
|
||||
static void update(const bool sflag);
|
||||
static inline void update_brightness() { update(false); }
|
||||
static inline void update_enabled() { update(true); }
|
||||
|
||||
private:
|
||||
#if ENABLED(CASE_LIGHT_USE_NEOPIXEL)
|
||||
static LEDColor color;
|
||||
#endif
|
||||
};
|
||||
|
||||
extern CaseLight caselight;
|
||||
|
@ -21,7 +21,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* emergency_parser.cpp - Intercept special commands directly in the serial stream
|
||||
* e_parser.cpp - Intercept special commands directly in the serial stream
|
||||
*/
|
||||
|
||||
#include "../inc/MarlinConfigPre.h"
|
||||
|
@ -22,7 +22,7 @@
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* emergency_parser.h - Intercept special commands directly in the serial stream
|
||||
* e_parser.h - Intercept special commands directly in the serial stream
|
||||
*/
|
||||
|
||||
#include "../inc/MarlinConfigPre.h"
|
||||
|
@ -20,45 +20,47 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../gcode.h"
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if HAS_CASE_LIGHT
|
||||
#include "../../../feature/caselight.h"
|
||||
#if ENABLED(CASE_LIGHT_ENABLE)
|
||||
|
||||
/**
|
||||
* M355: Turn case light on/off and set brightness
|
||||
*
|
||||
* P<byte> Set case light brightness (PWM pin required - ignored otherwise)
|
||||
*
|
||||
* S<bool> Set case light on/off
|
||||
*
|
||||
* When S turns on the light on a PWM pin then the current brightness level is used/restored
|
||||
*
|
||||
* M355 P200 S0 turns off the light & sets the brightness level
|
||||
* M355 S1 turns on the light with a brightness of 200 (assuming a PWM pin)
|
||||
*/
|
||||
void GcodeSuite::M355() {
|
||||
uint8_t args = 0;
|
||||
if (parser.seenval('P')) {
|
||||
++args, case_light_brightness = parser.value_byte();
|
||||
case_light_arg_flag = false;
|
||||
}
|
||||
if (parser.seenval('S')) {
|
||||
++args, case_light_on = parser.value_bool();
|
||||
case_light_arg_flag = true;
|
||||
}
|
||||
if (args) update_case_light();
|
||||
#include "../../../feature/caselight.h"
|
||||
#include "../../gcode.h"
|
||||
|
||||
// always report case light status
|
||||
SERIAL_ECHO_START();
|
||||
if (!case_light_on) {
|
||||
SERIAL_ECHOLNPGM("Case light: off");
|
||||
}
|
||||
else {
|
||||
if (!PWM_PIN(CASE_LIGHT_PIN)) SERIAL_ECHOLNPGM("Case light: on");
|
||||
else SERIAL_ECHOLNPAIR("Case light: ", case_light_brightness);
|
||||
}
|
||||
/**
|
||||
* M355: Turn case light on/off and set brightness
|
||||
*
|
||||
* P<byte> Set case light brightness (PWM pin required - ignored otherwise)
|
||||
*
|
||||
* S<bool> Set case light on/off
|
||||
*
|
||||
* When S turns on the light on a PWM pin then the current brightness level is used/restored
|
||||
*
|
||||
* M355 P200 S0 turns off the light & sets the brightness level
|
||||
* M355 S1 turns on the light with a brightness of 200 (assuming a PWM pin)
|
||||
*/
|
||||
void GcodeSuite::M355() {
|
||||
bool didset = false;
|
||||
if (parser.seenval('P')) {
|
||||
didset = true;
|
||||
caselight.brightness = parser.value_byte();
|
||||
}
|
||||
#endif // HAS_CASE_LIGHT
|
||||
const bool sflag = parser.seenval('S');
|
||||
if (sflag) {
|
||||
didset = true;
|
||||
caselight.on = parser.value_bool();
|
||||
}
|
||||
if (didset) caselight.update(sflag);
|
||||
|
||||
// Always report case light status
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOPGM("Case light: ");
|
||||
if (!caselight.on)
|
||||
SERIAL_ECHOLNPGM(STR_OFF);
|
||||
else {
|
||||
if (!PWM_PIN(CASE_LIGHT_PIN)) SERIAL_ECHOLNPGM(STR_ON);
|
||||
else SERIAL_ECHOLN(int(caselight.brightness));
|
||||
}
|
||||
}
|
||||
|
||||
#endif // CASE_LIGHT_ENABLE
|
||||
|
@ -842,7 +842,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
||||
case 351: M351(); break; // M351: Toggle MS1 MS2 pins directly, S# determines MS1 or MS2, X# sets the pin high/low.
|
||||
#endif
|
||||
|
||||
#if HAS_CASE_LIGHT
|
||||
#if ENABLED(CASE_LIGHT_ENABLE)
|
||||
case 355: M355(); break; // M355: Set case light brightness
|
||||
#endif
|
||||
|
||||
|
@ -702,7 +702,7 @@ private:
|
||||
static void M351();
|
||||
#endif
|
||||
|
||||
TERN_(HAS_CASE_LIGHT, static void M355());
|
||||
TERN_(CASE_LIGHT_ENABLE, static void M355());
|
||||
|
||||
TERN_(REPETIER_GCODE_M360, static void M360());
|
||||
|
||||
@ -845,7 +845,7 @@ private:
|
||||
TERN_(MAGNETIC_PARKING_EXTRUDER, static void M951());
|
||||
|
||||
TERN_(TOUCH_SCREEN_CALIBRATION, static void M995());
|
||||
|
||||
|
||||
TERN_(PLATFORM_M997_SUPPORT, static void M997());
|
||||
|
||||
static void M999();
|
||||
|
@ -93,8 +93,8 @@ void GcodeSuite::M115() {
|
||||
cap_line(PSTR("SOFTWARE_POWER"), ENABLED(PSU_CONTROL));
|
||||
|
||||
// TOGGLE_LIGHTS (M355)
|
||||
cap_line(PSTR("TOGGLE_LIGHTS"), ENABLED(HAS_CASE_LIGHT));
|
||||
cap_line(PSTR("CASE_LIGHT_BRIGHTNESS"), TERN0(HAS_CASE_LIGHT, PWM_PIN(CASE_LIGHT_PIN)));
|
||||
cap_line(PSTR("TOGGLE_LIGHTS"), ENABLED(CASE_LIGHT_ENABLE));
|
||||
cap_line(PSTR("CASE_LIGHT_BRIGHTNESS"), TERN0(CASE_LIGHT_ENABLE, PWM_PIN(CASE_LIGHT_PIN)));
|
||||
|
||||
// EMERGENCY_PARSER (M108, M112, M410, M876)
|
||||
cap_line(PSTR("EMERGENCY_PARSER"), ENABLED(EMERGENCY_PARSER));
|
||||
|
@ -40,7 +40,7 @@ GCodeQueue queue;
|
||||
#endif
|
||||
|
||||
#if ENABLED(BINARY_FILE_TRANSFER)
|
||||
#include "../feature/binary_protocol.h"
|
||||
#include "../feature/binary_stream.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
@ -628,11 +628,10 @@ void GCodeQueue::advance() {
|
||||
#if ENABLED(SERIAL_STATS_DROPPED_RX)
|
||||
SERIAL_ECHOLNPAIR("Dropped bytes: ", MYSERIAL0.dropped());
|
||||
#endif
|
||||
|
||||
#if ENABLED(SERIAL_STATS_MAX_RX_QUEUED)
|
||||
SERIAL_ECHOLNPAIR("Max RX Queue Size: ", MYSERIAL0.rxMaxEnqueued());
|
||||
#endif
|
||||
#endif // !defined(__AVR__) || !defined(USBCON)
|
||||
#endif
|
||||
|
||||
ok_to_send();
|
||||
}
|
||||
|
@ -430,14 +430,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(SR_LCD_3W_NL)
|
||||
// Feature checks for SR_LCD_3W_NL
|
||||
#elif EITHER(LCD_I2C_TYPE_MCP23017, LCD_I2C_TYPE_MCP23008)
|
||||
#define USES_LIQUIDTWI2
|
||||
#elif ANY(HAS_CHARACTER_LCD, LCD_I2C_TYPE_PCF8575, LCD_I2C_TYPE_PCA8574, SR_LCD_2W_NL, LCM1602)
|
||||
#define USES_LIQUIDCRYSTAL
|
||||
#endif
|
||||
|
||||
#if ENABLED(ULTIPANEL) && DISABLED(NO_LCD_MENUS)
|
||||
#define HAS_LCD_MENU 1
|
||||
#endif
|
||||
@ -774,10 +766,3 @@
|
||||
#ifndef EXTRUDE_MINTEMP
|
||||
#define EXTRUDE_MINTEMP 170
|
||||
#endif
|
||||
|
||||
/**
|
||||
* To check if we need the folder src/features/leds
|
||||
*/
|
||||
#if ANY(TEMP_STAT_LEDS, HAS_COLOR_LEDS, HAS_CASE_LIGHT, PRINTER_EVENT_LEDS, LED_BACKLIGHT_TIMEOUT, PCA9632_BUZZER, LED_CONTROL_MENU, NEOPIXEL_LED)
|
||||
#define HAS_LED_FEATURE 1
|
||||
#endif
|
||||
|
@ -1944,9 +1944,6 @@
|
||||
#if PIN_EXISTS(PHOTOGRAPH)
|
||||
#define HAS_PHOTOGRAPH 1
|
||||
#endif
|
||||
#if PIN_EXISTS(CASE_LIGHT) && ENABLED(CASE_LIGHT_ENABLE)
|
||||
#define HAS_CASE_LIGHT 1
|
||||
#endif
|
||||
|
||||
// Digital control
|
||||
#if PIN_EXISTS(STEPPER_RESET)
|
||||
@ -2223,7 +2220,7 @@
|
||||
/**
|
||||
* MIN/MAX case light PWM scaling
|
||||
*/
|
||||
#if HAS_CASE_LIGHT
|
||||
#if ENABLED(CASE_LIGHT_ENABLE)
|
||||
#ifndef CASE_LIGHT_MAX_PWM
|
||||
#define CASE_LIGHT_MAX_PWM 255
|
||||
#elif !WITHIN(CASE_LIGHT_MAX_PWM, 1, 255)
|
||||
|
@ -38,7 +38,7 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) {
|
||||
}
|
||||
|
||||
#ifdef TOUCH_UI_PORTRAIT
|
||||
#if EITHER(HAS_CASE_LIGHT, SENSORLESS_HOMING)
|
||||
#if EITHER(CASE_LIGHT_ENABLE, SENSORLESS_HOMING)
|
||||
#define GRID_ROWS 9
|
||||
#else
|
||||
#define GRID_ROWS 8
|
||||
@ -59,7 +59,7 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) {
|
||||
#define BACKLASH_POS BTN_POS(2,7), BTN_SIZE(1,1)
|
||||
#define CASE_LIGHT_POS BTN_POS(1,8), BTN_SIZE(1,1)
|
||||
#define TMC_HOMING_THRS_POS BTN_POS(2,8), BTN_SIZE(1,1)
|
||||
#if EITHER(HAS_CASE_LIGHT, SENSORLESS_HOMING)
|
||||
#if EITHER(CASE_LIGHT_ENABLE, SENSORLESS_HOMING)
|
||||
#define BACK_POS BTN_POS(1,9), BTN_SIZE(2,1)
|
||||
#else
|
||||
#define BACK_POS BTN_POS(1,8), BTN_SIZE(2,1)
|
||||
@ -91,7 +91,7 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) {
|
||||
.font(Theme::font_medium)
|
||||
.enabled(ENABLED(HAS_BED_PROBE))
|
||||
.tag(2) .button( ZPROBE_ZOFFSET_POS, GET_TEXT_F(MSG_ZPROBE_ZOFFSET))
|
||||
.enabled(ENABLED(HAS_CASE_LIGHT))
|
||||
.enabled(ENABLED(CASE_LIGHT_ENABLE))
|
||||
.tag(16).button( CASE_LIGHT_POS, GET_TEXT_F(MSG_CASE_LIGHT))
|
||||
.tag(3) .button( STEPS_PER_MM_POS, GET_TEXT_F(MSG_STEPS_PER_MM))
|
||||
.enabled(ENABLED(HAS_TRINAMIC_CONFIG))
|
||||
@ -149,7 +149,7 @@ bool AdvancedSettingsMenu::onTouchEnd(uint8_t tag) {
|
||||
case 14: GOTO_SCREEN(StepperBumpSensitivityScreen); break;
|
||||
#endif
|
||||
case 15: GOTO_SCREEN(DisplayTuningScreen); break;
|
||||
#if HAS_CASE_LIGHT
|
||||
#if ENABLED(CASE_LIGHT_ENABLE)
|
||||
case 16: GOTO_SCREEN(CaseLightScreen); break;
|
||||
#endif
|
||||
default: return false;
|
||||
|
@ -137,7 +137,7 @@ bool MainMenu::onTouchEnd(uint8_t tag) {
|
||||
case 4: GOTO_SCREEN(MoveAxisScreen); break;
|
||||
case 5: injectCommands_P(PSTR("M84")); break;
|
||||
case 6: GOTO_SCREEN(TemperatureScreen); break;
|
||||
#if BOTH(TOUCH_UI_COCOA_PRESS, HAS_CASE_LIGHT)
|
||||
#if BOTH(TOUCH_UI_COCOA_PRESS, CASE_LIGHT_ENABLE)
|
||||
case 7: GOTO_SCREEN(CaseLightScreen); break;
|
||||
#else
|
||||
case 7: GOTO_SCREEN(ChangeFilamentScreen); break;
|
||||
|
@ -83,7 +83,7 @@ SCREEN_TABLE {
|
||||
#else
|
||||
DECL_SCREEN(JerkScreen),
|
||||
#endif
|
||||
#if HAS_CASE_LIGHT
|
||||
#if ENABLED(CASE_LIGHT_ENABLE)
|
||||
DECL_SCREEN(CaseLightScreen),
|
||||
#endif
|
||||
#if EITHER(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR)
|
||||
|
@ -63,7 +63,7 @@ enum {
|
||||
#else
|
||||
JERK_SCREEN_CACHE,
|
||||
#endif
|
||||
#if HAS_CASE_LIGHT
|
||||
#if ENABLED(CASE_LIGHT_ENABLE)
|
||||
CASE_LIGHT_SCREEN_CACHE,
|
||||
#endif
|
||||
#if EITHER(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR)
|
||||
@ -579,7 +579,7 @@ class DefaultAccelerationScreen : public BaseNumericAdjustmentScreen, public Cac
|
||||
};
|
||||
#endif
|
||||
|
||||
#if HAS_CASE_LIGHT
|
||||
#if ENABLED(CASE_LIGHT_ENABLE)
|
||||
class CaseLightScreen : public BaseNumericAdjustmentScreen, public CachedScreen<CASE_LIGHT_SCREEN_CACHE> {
|
||||
public:
|
||||
static void onRedraw(draw_mode_t);
|
||||
|
@ -599,18 +599,18 @@ namespace ExtUI {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAS_CASE_LIGHT
|
||||
bool getCaseLightState() { return case_light_on; }
|
||||
#if ENABLED(CASE_LIGHT_ENABLE)
|
||||
bool getCaseLightState() { return caselight.on; }
|
||||
void setCaseLightState(const bool value) {
|
||||
case_light_on = value;
|
||||
update_case_light();
|
||||
caselight.on = value;
|
||||
caselight.update_enabled();
|
||||
}
|
||||
|
||||
#if DISABLED(CASE_LIGHT_NO_BRIGHTNESS)
|
||||
float getCaseLightBrightness_percent() { return ui8_to_percent(case_light_brightness); }
|
||||
float getCaseLightBrightness_percent() { return ui8_to_percent(caselight.brightness); }
|
||||
void setCaseLightBrightness_percent(const float value) {
|
||||
case_light_brightness = map(constrain(value, 0, 100), 0, 100, 0, 255);
|
||||
update_case_light();
|
||||
caselight.brightness = map(constrain(value, 0, 100), 0, 100, 0, 255);
|
||||
caselight.update_brightness();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -76,8 +76,8 @@
|
||||
void menu_case_light() {
|
||||
START_MENU();
|
||||
BACK_ITEM(MSG_CONFIGURATION);
|
||||
EDIT_ITEM(percent, MSG_CASE_LIGHT_BRIGHTNESS, &case_light_brightness, 0, 255, update_case_light, true);
|
||||
EDIT_ITEM(bool, MSG_CASE_LIGHT, (bool*)&case_light_on, update_case_light);
|
||||
EDIT_ITEM(percent, MSG_CASE_LIGHT_BRIGHTNESS, &caselight.brightness, 0, 255, caselight.update_brightness, true);
|
||||
EDIT_ITEM(bool, MSG_CASE_LIGHT, (bool*)&caselight.on, caselight.update_enabled);
|
||||
END_MENU();
|
||||
}
|
||||
#endif
|
||||
@ -97,7 +97,7 @@ void menu_led() {
|
||||
#endif
|
||||
SUBMENU(MSG_CUSTOM_LEDS, menu_led_custom);
|
||||
#endif
|
||||
//
|
||||
//
|
||||
// Set Case light on/off/brightness
|
||||
//
|
||||
#if ENABLED(CASE_LIGHT_MENU)
|
||||
@ -106,7 +106,7 @@ void menu_led() {
|
||||
SUBMENU(MSG_CASE_LIGHT, menu_case_light);
|
||||
else
|
||||
#endif
|
||||
EDIT_ITEM(bool, MSG_CASE_LIGHT, (bool*)&case_light_on, update_case_light);
|
||||
EDIT_ITEM(bool, MSG_CASE_LIGHT, (bool*)&caselight.on, caselight.update_enabled);
|
||||
#endif
|
||||
END_MENU();
|
||||
}
|
||||
|
@ -1,9 +1,36 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 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 <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(BINARY_FILE_TRANSFER)
|
||||
|
||||
/**
|
||||
* libs/heatshrink/heatshrink_decoder.cpp
|
||||
*/
|
||||
#include "heatshrink_decoder.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "heatshrink_decoder.h"
|
||||
|
||||
#pragma GCC optimize ("O3")
|
||||
|
||||
@ -353,3 +380,5 @@ static void push_byte(heatshrink_decoder *hsd, output_info *oi, uint8_t byte) {
|
||||
oi->buf[(*oi->output_size)++] = byte;
|
||||
(void)hsd;
|
||||
}
|
||||
|
||||
#endif // BINARY_FILE_TRANSFER
|
||||
|
@ -1,13 +1,36 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 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 <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* libs/heatshrink/heatshrink_decoder.h
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "heatshrink_common.h"
|
||||
#include "heatshrink_config.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef enum {
|
||||
HSDR_SINK_OK, /* data sunk, ready to poll */
|
||||
HSDR_SINK_FULL, /* out of space in internal buffer */
|
||||
|
@ -404,7 +404,7 @@ typedef struct SettingsDataStruct {
|
||||
// HAS_CASE_LIGHT_BRIGHTNESS
|
||||
//
|
||||
#if HAS_CASE_LIGHT_BRIGHTNESS
|
||||
uint8_t case_light_brightness;
|
||||
uint8_t caselight_brightness; // M355 P
|
||||
#endif
|
||||
|
||||
//
|
||||
@ -465,7 +465,7 @@ void MarlinSettings::postprocess() {
|
||||
|
||||
TERN_(HAS_LINEAR_E_JERK, planner.recalculate_max_e_jerk());
|
||||
|
||||
TERN_(HAS_CASE_LIGHT_BRIGHTNESS, update_case_light());
|
||||
TERN_(HAS_CASE_LIGHT_BRIGHTNESS, caselight.update_brightness());
|
||||
|
||||
// Refresh steps_to_mm with the reciprocal of axis_steps_per_mm
|
||||
// and init stepper.count[], planner.position[] with current_position
|
||||
@ -1342,7 +1342,7 @@ void MarlinSettings::postprocess() {
|
||||
// Case Light Brightness
|
||||
//
|
||||
#if HAS_CASE_LIGHT_BRIGHTNESS
|
||||
EEPROM_WRITE(case_light_brightness);
|
||||
EEPROM_WRITE(caselight.brightness);
|
||||
#endif
|
||||
|
||||
//
|
||||
@ -2181,8 +2181,8 @@ void MarlinSettings::postprocess() {
|
||||
// Case Light Brightness
|
||||
//
|
||||
#if HAS_CASE_LIGHT_BRIGHTNESS
|
||||
_FIELD_TEST(case_light_brightness);
|
||||
EEPROM_READ(case_light_brightness);
|
||||
_FIELD_TEST(caselight_brightness);
|
||||
EEPROM_READ(caselight.brightness);
|
||||
#endif
|
||||
|
||||
//
|
||||
@ -2493,7 +2493,7 @@ void MarlinSettings::reset() {
|
||||
//
|
||||
// Case Light Brightness
|
||||
//
|
||||
TERN_(HAS_CASE_LIGHT_BRIGHTNESS, case_light_brightness = CASE_LIGHT_DEFAULT_BRIGHTNESS);
|
||||
TERN_(HAS_CASE_LIGHT_BRIGHTNESS, caselight.brightness = CASE_LIGHT_DEFAULT_BRIGHTNESS);
|
||||
|
||||
//
|
||||
// TOUCH_SCREEN_CALIBRATION
|
||||
|
Reference in New Issue
Block a user