Browse Source

Patch for caselight + lcd compile issues

pull/1/head
Scott Lahteine 7 years ago
parent
commit
bfd1e75c04
  1. 3
      Marlin/src/feature/caselight.cpp
  2. 2
      Marlin/src/feature/caselight.h
  3. 6
      Marlin/src/lcd/ultralcd.cpp

3
Marlin/src/feature/caselight.cpp

@ -24,7 +24,7 @@
#if HAS_CASE_LIGHT #if HAS_CASE_LIGHT
int case_light_brightness = CASE_LIGHT_DEFAULT_BRIGHTNESS; uint8_t case_light_brightness = CASE_LIGHT_DEFAULT_BRIGHTNESS;
bool case_light_on = CASE_LIGHT_DEFAULT_ON; bool case_light_on = CASE_LIGHT_DEFAULT_ON;
#ifndef INVERT_CASE_LIGHT #ifndef INVERT_CASE_LIGHT
@ -33,7 +33,6 @@ bool case_light_on = CASE_LIGHT_DEFAULT_ON;
void update_case_light() { void update_case_light() {
SET_OUTPUT(CASE_LIGHT_PIN); SET_OUTPUT(CASE_LIGHT_PIN);
uint8_t case_light_bright = (uint8_t)case_light_brightness;
if (case_light_on) { if (case_light_on) {
if (USEABLE_HARDWARE_PWM(CASE_LIGHT_PIN)) { if (USEABLE_HARDWARE_PWM(CASE_LIGHT_PIN)) {
analogWrite(CASE_LIGHT_PIN, INVERT_CASE_LIGHT ? 255 - case_light_brightness : case_light_brightness ); analogWrite(CASE_LIGHT_PIN, INVERT_CASE_LIGHT ? 255 - case_light_brightness : case_light_brightness );

2
Marlin/src/feature/caselight.h

@ -23,7 +23,7 @@
#ifndef __CASELIGHT_H__ #ifndef __CASELIGHT_H__
#define __CASELIGHT_H__ #define __CASELIGHT_H__
extern int case_light_brightness; // LCD routine wants INT extern uint8_t case_light_brightness;
extern bool case_light_on; extern bool case_light_on;
void update_case_light(); void update_case_light();

6
Marlin/src/lcd/ultralcd.cpp

@ -761,9 +761,7 @@ void kill_screen(const char* lcd_msg) {
#if ENABLED(MENU_ITEM_CASE_LIGHT) #if ENABLED(MENU_ITEM_CASE_LIGHT)
extern int case_light_brightness; #include "../feature/caselight.h"
extern bool case_light_on;
extern void update_case_light();
void case_light_menu() { void case_light_menu() {
START_MENU(); START_MENU();
@ -771,7 +769,7 @@ void kill_screen(const char* lcd_msg) {
// ^ Main // ^ Main
// //
MENU_BACK(MSG_MAIN); MENU_BACK(MSG_MAIN);
MENU_ITEM_EDIT_CALLBACK(int3, MSG_CASE_LIGHT_BRIGHTNESS, &case_light_brightness, 0, 255, update_case_light, true); MENU_ITEM_EDIT_CALLBACK(int8, MSG_CASE_LIGHT_BRIGHTNESS, &case_light_brightness, 0, 255, update_case_light, true);
MENU_ITEM_EDIT_CALLBACK(bool, MSG_CASE_LIGHT, (bool*)&case_light_on, update_case_light); MENU_ITEM_EDIT_CALLBACK(bool, MSG_CASE_LIGHT, (bool*)&case_light_on, update_case_light);
END_MENU(); END_MENU();
} }

Loading…
Cancel
Save