Prusa MINI Firmware overview
caselight.cpp File Reference

Macros

#define INVERT_CASE_LIGHT   false
 

Functions

void update_case_light ()
 

Variables

uint8_t case_light_brightness = CASE_LIGHT_DEFAULT_BRIGHTNESS
 
bool case_light_on = CASE_LIGHT_DEFAULT_ON
 
uint8_t case_light_brightness_sav
 
bool case_light_arg_flag
 

Macro Definition Documentation

◆ INVERT_CASE_LIGHT

#define INVERT_CASE_LIGHT   false

Function Documentation

◆ update_case_light()

void update_case_light ( )
54  {
55 
57  case_light_brightness_sav = case_light_brightness; // save brightness except if this is an S0 argument
59  case_light_brightness = case_light_brightness_sav; // restore last brightens if this is an S1 argument
60 
61  const uint8_t i = case_light_on ? case_light_brightness : 0, n10ct = INVERT_CASE_LIGHT ? 255 - i : i;
62 
63  #if ENABLED(CASE_LIGHT_USE_NEOPIXEL)
64 
66  MakeLEDColor(case_light_color.r, case_light_color.g, case_light_color.b, case_light_color.w, n10ct),
67  false
68  );
69 
70  #else // !CASE_LIGHT_USE_NEOPIXEL
71 
72  #if DISABLED(CASE_LIGHT_NO_BRIGHTNESS)
75  #if CASE_LIGHT_MAX_PWM == 255
76  n10ct
77  #else
78  map(n10ct, 0, 255, 0, CASE_LIGHT_MAX_PWM)
79  #endif
80  );
81  else
82  #endif
83  {
85  WRITE(CASE_LIGHT_PIN, s ? HIGH : LOW);
86  }
87 
88  #endif // !CASE_LIGHT_USE_NEOPIXEL
89 }
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ case_light_brightness

uint8_t case_light_brightness = CASE_LIGHT_DEFAULT_BRIGHTNESS

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/.

◆ case_light_on

bool case_light_on = CASE_LIGHT_DEFAULT_ON

◆ case_light_brightness_sav

uint8_t case_light_brightness_sav

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.

◆ case_light_arg_flag

bool case_light_arg_flag
LEDLights::set_color
static void set_color(const LEDColor &color)
MakeLEDColor
#define MakeLEDColor(R, G, B, W, I)
Definition: leds.h:124
INVERT_CASE_LIGHT
#define INVERT_CASE_LIGHT
Definition: caselight.cpp:51
LOW
#define LOW
Definition: wiring_constants.h:70
i
uint8_t i
Definition: screen_test_graph.c:72
map
long map(long x, long in_min, long in_max, long out_min, long out_max)
Definition: WMath.cpp:49
PWM_PIN
bool PWM_PIN(const pin_t p)
pin_t
int8_t pin_t
Definition: HAL.h:65
case_light_on
bool case_light_on
Definition: caselight.cpp:28
CASE_LIGHT_PIN
#define CASE_LIGHT_PIN
Definition: pins_GT2560_V3.h:144
WRITE
#define WRITE(IO, V)
Definition: fastio.h:96
uint8_t
const uint8_t[]
Definition: 404_html.c:3
HIGH
#define HIGH
Definition: wiring_constants.h:71
leds
LEDLights leds
case_light_brightness
uint8_t case_light_brightness
Definition: caselight.cpp:27
case_light_brightness_sav
uint8_t case_light_brightness_sav
Definition: caselight.cpp:47
case_light_arg_flag
bool case_light_arg_flag
Definition: caselight.cpp:48
analogWrite
void analogWrite(uint32_t ulPin, uint32_t ulValue)
Definition: wiring_analog.c:12