diff --git a/src/src.ino b/src/src.ino index 8f9391f..03d1a50 100644 --- a/src/src.ino +++ b/src/src.ino @@ -55,6 +55,9 @@ void setup() { // homeSpan.setLogLevel(-1); homeSpan.enableOTA(); + homeSpan.setStatusPin(13); + homeSpan.setStatusAutoOff(20); + homeSpan.begin(Category::Lighting,"HomeSpan LED"); new SpanAccessory(); diff --git a/src/src/extras/Blinker.cpp b/src/src/extras/Blinker.cpp index 1bf30d4..ea5cbbe 100644 --- a/src/src/extras/Blinker.cpp +++ b/src/src/extras/Blinker.cpp @@ -134,7 +134,7 @@ void Blinker::check(){ if(pauseDuration==0 || isPaused || (millis()-pauseTime) #include +[[maybe_unused]] static const char* BLINKER_TAG = "Blinker"; + //////////////////////////////// // Blinkable Interface // //////////////////////////////// diff --git a/src/src/extras/Pixel.h b/src/src/extras/Pixel.h index 6cf4945..929b8a6 100644 --- a/src/src/extras/Pixel.h +++ b/src/src/extras/Pixel.h @@ -35,6 +35,8 @@ #include "PwmPin.h" #include "Blinker.h" +[[maybe_unused]] static const char* PIXEL_TAG = "Pixel"; + //////////////////////////////////////////// // Single-Wire RGB/RGBW NeoPixels // //////////////////////////////////////////// diff --git a/src/src/extras/PwmPin.cpp b/src/src/extras/PwmPin.cpp index d39b704..ca15e24 100644 --- a/src/src/extras/PwmPin.cpp +++ b/src/src/extras/PwmPin.cpp @@ -52,7 +52,7 @@ LedC::LedC(uint8_t pin, uint16_t freq, boolean invert){ timerList[nTimer][nMode]->duty_resolution=(ledc_timer_bit_t)res; if(ledc_timer_config(timerList[nTimer][nMode])!=0){ - Serial.printf("\n*** ERROR: Frequency=%d Hz is out of allowed range ---",freq); + ESP_LOGW(PWM_TAG,"Frequency=%d Hz is out of allowed range ---",freq); delete timerList[nTimer][nMode]; timerList[nTimer][nMode]=NULL; return; @@ -82,10 +82,12 @@ LedC::LedC(uint8_t pin, uint16_t freq, boolean invert){ LedPin::LedPin(uint8_t pin, float level, uint16_t freq, boolean invert) : LedC(pin, freq, invert){ - if(!channel) - Serial.printf("\n*** ERROR: Can't create LedPin(%d) - no open PWM channels and/or Timers ***\n\n",pin); + if(!channel){ + ESP_LOGW(PWM_TAG,"Can't create LedPin(%d) - no open PWM channels and/or Timers",pin); + return; + } else - Serial.printf("LedPin=%d: mode=%d, channel=%d, timer=%d, freq=%d Hz, resolution=%d bits %s\n", + ESP_LOGI(PWM_TAG,"LedPin=%d: mode=%d, channel=%d, timer=%d, freq=%d Hz, resolution=%d bits %s", channel->gpio_num, channel->speed_mode, channel->channel, @@ -222,9 +224,9 @@ void LedPin::HSVtoRGB(float h, float s, float v, float *r, float *g, float *b ){ ServoPin::ServoPin(uint8_t pin, double initDegrees, uint16_t minMicros, uint16_t maxMicros, double minDegrees, double maxDegrees) : LedC(pin, 50){ if(!channel) - Serial.printf("\n*** ERROR: Can't create ServoPin(%d) - no open PWM channels and/or Timers ***\n\n",pin); + ESP_LOGW(PWM_TAG,"Can't create ServoPin(%d) - no open PWM channels and/or Timers",pin); else - Serial.printf("ServoPin=%d: mode=%d channel=%d, timer=%d, freq=%d Hz, resolution=%d bits\n", + ESP_LOGI(PWM_TAG,"ServoPin=%d: mode=%d channel=%d, timer=%d, freq=%d Hz, resolution=%d bits", channel->gpio_num, channel->speed_mode, channel->channel, diff --git a/src/src/extras/PwmPin.h b/src/src/extras/PwmPin.h index fe5dae5..6528257 100644 --- a/src/src/extras/PwmPin.h +++ b/src/src/extras/PwmPin.h @@ -46,6 +46,8 @@ #include #include "Blinker.h" +[[maybe_unused]] static const char* PWM_TAG = "PwmPin"; + #define DEFAULT_PWM_FREQ 5000 ///////////////////////////////////// diff --git a/src/src/extras/RFControl.cpp b/src/src/extras/RFControl.cpp index f00d4b5..3a50402 100644 --- a/src/src/extras/RFControl.cpp +++ b/src/src/extras/RFControl.cpp @@ -36,7 +36,7 @@ RFControl::RFControl(uint8_t pin, boolean refClock, boolean installDriver){ #else if(nChannels==RMT_CHANNEL_MAX){ #endif - Serial.printf("\n*** ERROR: Can't create RFControl(%d) - no open channels ***\n\n",pin); + ESP_LOGW(RFControl_TAG,"Can't create RFControl(%d) - no open channels",pin); return; } @@ -139,17 +139,17 @@ void RFControl::enableCarrier(uint32_t freq, float duty){ uint32_t lowTime=period*(1.0-duty)+0.5; if(highTime>0xFFFF || lowTime>0xFFFF){ - Serial.printf("\n*** ERROR: Can't enable carrier frequency=%d Hz for RF Control pin=%d, duty=%0.2f. Frequency is too low!\n\n",freq,config->gpio_num,duty); + ESP_LOGW(RFControl_TAG,"Can't enable carrier frequency=%d Hz for RF Control pin=%d, duty=%0.2f. Frequency is too low!",freq,config->gpio_num,duty); return; } if(highTime==0){ - Serial.printf("\n*** ERROR: Can't enable carrier frequency=%d Hz for RF Control pin=%d, duty=%0.2f. Duty is too low or frequency is too high!\n\n",freq,config->gpio_num,duty); + ESP_LOGW(RFControl_TAG,"Can't enable carrier frequency=%d Hz for RF Control pin=%d, duty=%0.2f. Duty is too low or frequency is too high!",freq,config->gpio_num,duty); return; } if(lowTime==0){ - Serial.printf("\n*** ERROR: Can't enable carrier frequency=%d Hz for RF Control pin=%d, duty=%0.2f. Duty is too high or frequency is too high!\n\n",freq,config->gpio_num,duty); + ESP_LOGW(RFControl_TAG,"Can't enable carrier frequency=%d Hz for RF Control pin=%d, duty=%0.2f. Duty is too high or frequency is too high!",freq,config->gpio_num,duty); return; } diff --git a/src/src/extras/RFControl.h b/src/src/extras/RFControl.h index 47e5d45..7def768 100644 --- a/src/src/extras/RFControl.h +++ b/src/src/extras/RFControl.h @@ -36,6 +36,8 @@ #include "driver/rmt.h" #include +[[maybe_unused]] static const char* RFControl_TAG = "RFControl"; + using std::vector; class RFControl { diff --git a/src/src/extras/extras.ino b/src/src/extras/extras.ino index 072d8d9..090ae0b 100644 --- a/src/src/extras/extras.ino +++ b/src/src/extras/extras.ino @@ -38,9 +38,24 @@ void setup() { Serial.println("\n\nHomeSpan LED Fade Test\n"); - LedPin red(33,0); - LedPin green(32,0); + LedPin red(14,0); + LedPin green(14,0); LedPin blue(14,0); + LedPin blue2(14,0,1000); + LedPin blue3(14,0,2000); + LedPin blue4(14,0,3000); + LedPin blue5(14,0,60000); + LedPin blue6(14,0,5000); + LedPin blue7(14,0,6000); + LedPin blue8(14,0,7000); + LedPin blue9(14,0,8000); + LedPin blue10(14,0,8000); + LedPin blue11(14,0,8000); + LedPin blue12(14,0,8000); + LedPin blue13(14,0,8000); + LedPin blue14(14,0,5000); + LedPin blue15(14,0,5000); + LedPin blue16(14,0,15000); int redLevel=0;