@@ -253,7 +253,7 @@ void handleSerial() {
253253
254254// Notification LED
255255void flashLED (int flashtime) {
256- #ifdef LED_PIN // If we have it; flash it.
256+ #if defined( LED_PIN) // If we have it; flash it.
257257 digitalWrite (LED_PIN, LED_ON); // On at full power.
258258 delay (flashtime); // delay
259259 digitalWrite (LED_PIN, LED_OFF); // turn Off
@@ -264,6 +264,7 @@ void flashLED(int flashtime) {
264264
265265// Lamp Control
266266void setLamp (int newVal) {
267+ #if defined(LAMP_PIN)
267268 if (newVal != -1 ) {
268269 // Apply a logarithmic function to the scale.
269270 int brightness = round ((pow (2 ,(1 +(newVal*0.02 )))-2 )/6 *pwmMax);
@@ -273,6 +274,7 @@ void setLamp(int newVal) {
273274 Serial.print (" %, pwm = " );
274275 Serial.println (brightness);
275276 }
277+ #endif
276278}
277279
278280void printLocalTime (bool extraData=false ) {
@@ -763,10 +765,12 @@ void setup() {
763765
764766 // Initialise and set the lamp
765767 if (lampVal != -1 ) {
766- ledcSetup (lampChannel, pwmfreq, pwmresolution); // configure LED PWM channel
767- ledcAttachPin (LAMP_PIN, lampChannel); // attach the GPIO pin to the channel
768- if (autoLamp) setLamp (0 ); // set default value
769- else setLamp (lampVal);
768+ #if defined(LAMP_PIN)
769+ ledcSetup (lampChannel, pwmfreq, pwmresolution); // configure LED PWM channel
770+ ledcAttachPin (LAMP_PIN, lampChannel); // attach the GPIO pin to the channel
771+ if (autoLamp) setLamp (0 ); // set default value
772+ else setLamp (lampVal);
773+ #endif
770774 } else {
771775 Serial.println (" No lamp, or lamp disabled in config" );
772776 }
0 commit comments