Make some log messages compile dependant

Make some log messages compile dependant
This commit is contained in:
Theo Arends 2019-08-08 17:51:49 +02:00
parent 38a1e7ba42
commit a1a6590715
5 changed files with 14 additions and 22 deletions

View File

@ -1259,7 +1259,7 @@ void GpioInit(void)
for (uint32_t i = 0; i < sizeof(my_module.io); i++) {
mpin = ValidPin(i, my_module.io[i]);
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DBG: gpio pin %d, mpin %d"), i, mpin);
DEBUG_CORE_LOG(PSTR("INI: gpio pin %d, mpin %d"), i, mpin);
if (mpin) {
if ((mpin >= GPIO_SWT1_NP) && (mpin < (GPIO_SWT1_NP + MAX_SWITCHES))) {

View File

@ -156,7 +156,7 @@ void CommandHandler(char* topic, uint8_t* data, uint32_t data_len)
type[i] = '\0';
}
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_COMMAND D_GROUP " %d, " D_INDEX " %d, " D_COMMAND " \"%s\", " D_DATA " \"%s\""), grpflg, index, type, dataBuf);
DEBUG_CORE_LOG(PSTR("CMD: " D_GROUP " %d, " D_INDEX " %d, " D_COMMAND " \"%s\", " D_DATA " \"%s\""), grpflg, index, type, dataBuf);
if (type != nullptr) {
Response_P(PSTR("{\"" D_JSON_COMMAND "\":\"" D_JSON_ERROR "\"}"));
@ -171,7 +171,7 @@ void CommandHandler(char* topic, uint8_t* data, uint32_t data_len)
int temp_payload = GetStateNumber(dataBuf);
if (temp_payload > -1) { payload = temp_payload; }
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_RESULT "Payload %d"), payload);
DEBUG_CORE_LOG(PSTR("CMD: Payload %d"), payload);
backlog_delay = millis() + (100 * MIN_BACKLOG_DELAY);

View File

@ -121,7 +121,7 @@ void RotaryHandler(void)
if (t > 500) {
t = 500;
}
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_CMND_COLORTEMPERATURE " %d"), rotary_position - rotary_last_position);
DEBUG_CORE_LOG(PSTR("ROT: " D_CMND_COLORTEMPERATURE " %d"), rotary_position - rotary_last_position);
LightSetColorTemp((uint16_t)t);
} else {
int8_t d = Settings.light_dimmer;
@ -132,7 +132,7 @@ void RotaryHandler(void)
if (d > 100) {
d = 100;
}
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_CMND_DIMMER " %d"), rotary_position - rotary_last_position);
DEBUG_CORE_LOG(PSTR("ROT: " D_CMND_DIMMER " %d"), rotary_position - rotary_last_position);
LightSetDimmer((uint8_t)d);
Settings.light_dimmer = d;

View File

@ -1437,7 +1437,7 @@ void HandleWifiConfiguration(void)
cssid = WiFi.SSID(indices[i]);
for (uint32_t j = i + 1; j < n; j++) {
if (cssid == WiFi.SSID(indices[j])) {
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI D_DUPLICATE_ACCESSPOINT " %s"), WiFi.SSID(indices[j]).c_str());
DEBUG_DRIVER_LOG(PSTR(D_LOG_WIFI D_DUPLICATE_ACCESSPOINT " %s"), WiFi.SSID(indices[j]).c_str());
indices[j] = -1; // set dup aps to index -1
}
}
@ -1447,7 +1447,8 @@ void HandleWifiConfiguration(void)
//display networks in page
for (uint32_t i = 0; i < n; i++) {
if (-1 == indices[i]) { continue; } // skip dups
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI D_SSID " %s, " D_BSSID " %s, " D_CHANNEL " %d, " D_RSSI " %d"), WiFi.SSID(indices[i]).c_str(), WiFi.BSSIDstr(indices[i]).c_str(), WiFi.channel(indices[i]), WiFi.RSSI(indices[i]));
DEBUG_DRIVER_LOG(PSTR(D_LOG_WIFI D_SSID " %s, " D_BSSID " %s, " D_CHANNEL " %d, " D_RSSI " %d"),
WiFi.SSID(indices[i]).c_str(), WiFi.BSSIDstr(indices[i]).c_str(), WiFi.channel(indices[i]), WiFi.RSSI(indices[i]));
int quality = WifiGetRssiAsQuality(WiFi.RSSI(indices[i]));
if (minimum_signal_quality == -1 || minimum_signal_quality < quality) {

View File

@ -1093,7 +1093,7 @@ void AriluxRfHandler(void)
}
uint16_t stored_hostcode = Settings.rf_code[1][6] << 8 | Settings.rf_code[1][7];
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_RFR D_HOST D_CODE " 0x%04X, " D_RECEIVED " 0x%06X"), stored_hostcode, arilux_rf_received_value);
DEBUG_DRIVER_LOG(PSTR(D_LOG_RFR D_HOST D_CODE " 0x%04X, " D_RECEIVED " 0x%06X"), stored_hostcode, arilux_rf_received_value);
if (hostcode == stored_hostcode) {
char command[33];
@ -1257,8 +1257,7 @@ void LightMy92x1Duty(uint8_t duty_r, uint8_t duty_g, uint8_t duty_b, uint8_t dut
*
\*********************************************************************************************/
// Enable this for debug logging
//#define D_LOG_SM16716 "SM16716: "
#define D_LOG_SM16716 "SM16716: "
uint8_t sm16716_pin_clk = 100;
uint8_t sm16716_pin_dat = 100;
@ -1293,9 +1292,7 @@ void SM16716_Update(uint8_t duty_r, uint8_t duty_g, uint8_t duty_b)
if (sm16716_pin_sel < 99) {
uint8_t sm16716_should_enable = (duty_r | duty_g | duty_b);
if (!sm16716_enabled && sm16716_should_enable) {
#ifdef D_LOG_SM16716
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_SM16716 "turning color on"));
#endif // D_LOG_SM16716
DEBUG_DRIVER_LOG(PSTR(D_LOG_SM16716 "turning color on"));
sm16716_enabled = 1;
digitalWrite(sm16716_pin_sel, HIGH);
// in testing I found it takes a minimum of ~380us to wake up the chip
@ -1304,16 +1301,12 @@ void SM16716_Update(uint8_t duty_r, uint8_t duty_g, uint8_t duty_b)
SM16716_Init();
}
else if (sm16716_enabled && !sm16716_should_enable) {
#ifdef D_LOG_SM16716
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_SM16716 "turning color off"));
#endif // D_LOG_SM16716
DEBUG_DRIVER_LOG(PSTR(D_LOG_SM16716 "turning color off"));
sm16716_enabled = 0;
digitalWrite(sm16716_pin_sel, LOW);
}
}
#ifdef D_LOG_SM16716
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_SM16716 "Update; rgb=%02x%02x%02x"), duty_r, duty_g, duty_b);
#endif // D_LOG_SM16716
DEBUG_DRIVER_LOG(PSTR(D_LOG_SM16716 "Update; rgb=%02x%02x%02x"), duty_r, duty_g, duty_b);
// send start bit
SM16716_SendBit(1);
@ -1336,9 +1329,7 @@ bool SM16716_ModuleSelected(void)
sm16716_pin_clk = pin[GPIO_SM16716_CLK];
sm16716_pin_dat = pin[GPIO_SM16716_DAT];
sm16716_pin_sel = pin[GPIO_SM16716_SEL];
#ifdef D_LOG_SM16716
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_SM16716 "ModuleSelected; clk_pin=%d, dat_pin=%d)"), sm16716_pin_clk, sm16716_pin_dat);
#endif // D_LOG_SM16716
DEBUG_DRIVER_LOG(PSTR(D_LOG_SM16716 "ModuleSelected; clk_pin=%d, dat_pin=%d)"), sm16716_pin_clk, sm16716_pin_dat);
return (sm16716_pin_clk < 99) && (sm16716_pin_dat < 99);
}