Converted Serial.printf in extra classes to ESP_LOGI and ESP_LOGW
Changed Serial.printf() diagnostic messages to either ESP_LOGI() or ESP_LOGW() macros in Blinker, PWM (LedPin and ServoPin), Pixel, and RFControl class
This commit is contained in:
parent
7bc885dd26
commit
de97faee37
|
|
@ -55,6 +55,9 @@ void setup() {
|
||||||
// homeSpan.setLogLevel(-1);
|
// homeSpan.setLogLevel(-1);
|
||||||
homeSpan.enableOTA();
|
homeSpan.enableOTA();
|
||||||
|
|
||||||
|
homeSpan.setStatusPin(13);
|
||||||
|
homeSpan.setStatusAutoOff(20);
|
||||||
|
|
||||||
homeSpan.begin(Category::Lighting,"HomeSpan LED");
|
homeSpan.begin(Category::Lighting,"HomeSpan LED");
|
||||||
|
|
||||||
new SpanAccessory();
|
new SpanAccessory();
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ void Blinker::check(){
|
||||||
if(pauseDuration==0 || isPaused || (millis()-pauseTime)<pauseDuration)
|
if(pauseDuration==0 || isPaused || (millis()-pauseTime)<pauseDuration)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Serial.print("Pausing LED\n");
|
ESP_LOGI(BLINKER_TAG,"Pausing LED");
|
||||||
off();
|
off();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,8 @@
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <driver/timer.h>
|
#include <driver/timer.h>
|
||||||
|
|
||||||
|
[[maybe_unused]] static const char* BLINKER_TAG = "Blinker";
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
// Blinkable Interface //
|
// Blinkable Interface //
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,8 @@
|
||||||
#include "PwmPin.h"
|
#include "PwmPin.h"
|
||||||
#include "Blinker.h"
|
#include "Blinker.h"
|
||||||
|
|
||||||
|
[[maybe_unused]] static const char* PIXEL_TAG = "Pixel";
|
||||||
|
|
||||||
////////////////////////////////////////////
|
////////////////////////////////////////////
|
||||||
// Single-Wire RGB/RGBW NeoPixels //
|
// Single-Wire RGB/RGBW NeoPixels //
|
||||||
////////////////////////////////////////////
|
////////////////////////////////////////////
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ LedC::LedC(uint8_t pin, uint16_t freq, boolean invert){
|
||||||
|
|
||||||
timerList[nTimer][nMode]->duty_resolution=(ledc_timer_bit_t)res;
|
timerList[nTimer][nMode]->duty_resolution=(ledc_timer_bit_t)res;
|
||||||
if(ledc_timer_config(timerList[nTimer][nMode])!=0){
|
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];
|
delete timerList[nTimer][nMode];
|
||||||
timerList[nTimer][nMode]=NULL;
|
timerList[nTimer][nMode]=NULL;
|
||||||
return;
|
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){
|
LedPin::LedPin(uint8_t pin, float level, uint16_t freq, boolean invert) : LedC(pin, freq, invert){
|
||||||
|
|
||||||
if(!channel)
|
if(!channel){
|
||||||
Serial.printf("\n*** ERROR: Can't create LedPin(%d) - no open PWM channels and/or Timers ***\n\n",pin);
|
ESP_LOGW(PWM_TAG,"Can't create LedPin(%d) - no open PWM channels and/or Timers",pin);
|
||||||
|
return;
|
||||||
|
}
|
||||||
else
|
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->gpio_num,
|
||||||
channel->speed_mode,
|
channel->speed_mode,
|
||||||
channel->channel,
|
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){
|
ServoPin::ServoPin(uint8_t pin, double initDegrees, uint16_t minMicros, uint16_t maxMicros, double minDegrees, double maxDegrees) : LedC(pin, 50){
|
||||||
|
|
||||||
if(!channel)
|
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
|
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->gpio_num,
|
||||||
channel->speed_mode,
|
channel->speed_mode,
|
||||||
channel->channel,
|
channel->channel,
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,8 @@
|
||||||
#include <driver/ledc.h>
|
#include <driver/ledc.h>
|
||||||
#include "Blinker.h"
|
#include "Blinker.h"
|
||||||
|
|
||||||
|
[[maybe_unused]] static const char* PWM_TAG = "PwmPin";
|
||||||
|
|
||||||
#define DEFAULT_PWM_FREQ 5000
|
#define DEFAULT_PWM_FREQ 5000
|
||||||
|
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ RFControl::RFControl(uint8_t pin, boolean refClock, boolean installDriver){
|
||||||
#else
|
#else
|
||||||
if(nChannels==RMT_CHANNEL_MAX){
|
if(nChannels==RMT_CHANNEL_MAX){
|
||||||
#endif
|
#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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -139,17 +139,17 @@ void RFControl::enableCarrier(uint32_t freq, float duty){
|
||||||
uint32_t lowTime=period*(1.0-duty)+0.5;
|
uint32_t lowTime=period*(1.0-duty)+0.5;
|
||||||
|
|
||||||
if(highTime>0xFFFF || lowTime>0xFFFF){
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(highTime==0){
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(lowTime==0){
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,8 @@
|
||||||
#include "driver/rmt.h"
|
#include "driver/rmt.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
[[maybe_unused]] static const char* RFControl_TAG = "RFControl";
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
||||||
class RFControl {
|
class RFControl {
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,24 @@ void setup() {
|
||||||
|
|
||||||
Serial.println("\n\nHomeSpan LED Fade Test\n");
|
Serial.println("\n\nHomeSpan LED Fade Test\n");
|
||||||
|
|
||||||
LedPin red(33,0);
|
LedPin red(14,0);
|
||||||
LedPin green(32,0);
|
LedPin green(14,0);
|
||||||
LedPin blue(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;
|
int redLevel=0;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue