Case light brightness cleanup (#19856)

Co-authored-by: Chris <chris@chrisnovoa.com>
This commit is contained in:
Scott Lahteine
2020-10-22 22:31:48 -05:00
parent b1b2ecba6c
commit f9b04af650
7 changed files with 56 additions and 33 deletions

View File

@@ -41,10 +41,12 @@
*/
void GcodeSuite::M355() {
bool didset = false;
if (parser.seenval('P')) {
didset = true;
caselight.brightness = parser.value_byte();
}
#if CASELIGHT_USES_BRIGHTNESS
if (parser.seenval('P')) {
didset = true;
caselight.brightness = parser.value_byte();
}
#endif
const bool sflag = parser.seenval('S');
if (sflag) {
didset = true;
@@ -58,8 +60,13 @@ void GcodeSuite::M355() {
if (!caselight.on)
SERIAL_ECHOLNPGM(STR_OFF);
else {
if (!PWM_PIN(CASE_LIGHT_PIN)) SERIAL_ECHOLNPGM(STR_ON);
else SERIAL_ECHOLN(int(caselight.brightness));
#if CASELIGHT_USES_BRIGHTNESS
if (PWM_PIN(CASE_LIGHT_PIN)) {
SERIAL_ECHOLN(int(caselight.brightness));
return;
}
#endif
SERIAL_ECHOLNPGM(STR_ON);
}
}