Skip to content

Commit

Permalink
refactoring: convert all logging tags to component names
Browse files Browse the repository at this point in the history
  • Loading branch information
UncleRus committed Feb 1, 2021
1 parent 9e30f6a commit b6b9b02
Show file tree
Hide file tree
Showing 34 changed files with 39 additions and 39 deletions.
2 changes: 1 addition & 1 deletion components/ads111x/ads111x.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#define CHECK(x) do { esp_err_t __; if ((__ = x) != ESP_OK) return __; } while (0)
#define CHECK_ARG(VAL) do { if (!(VAL)) return ESP_ERR_INVALID_ARG; } while (0)

static const char *TAG = "ADS111x";
static const char *TAG = "ads111x";

const float ads111x_gain_values[] = {
[ADS111X_GAIN_6V144] = 6.144,
Expand Down
2 changes: 1 addition & 1 deletion components/bh1750/bh1750.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

#define I2C_FREQ_HZ 400000

static const char *TAG = "BH1750";
static const char *TAG = "bh1750";

#define CHECK(x) do { esp_err_t __; if ((__ = x) != ESP_OK) return __; } while (0)
#define CHECK_ARG(VAL) do { if (!(VAL)) return ESP_ERR_INVALID_ARG; } while (0)
Expand Down
2 changes: 1 addition & 1 deletion components/bme680/bme680.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
#define BME680_CDM_RHR 43 // 0x02 - res_heat_range
#define BME680_CDM_RSWE 45 // 0x04 - range_sw_error

static const char *TAG = "BME680";
static const char *TAG = "bme680";

#define CHECK(x) do { esp_err_t __; if ((__ = x) != ESP_OK) return __; } while (0)
#define CHECK_ARG(VAL) do { if (!(VAL)) return ESP_ERR_INVALID_ARG; } while (0)
Expand Down
2 changes: 1 addition & 1 deletion components/bmp180/bmp180.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#define I2C_FREQ_HZ 1000000 // Max 1MHz for esp-idf

static const char *TAG = "BMP180";
static const char *TAG = "bmp180";

#define BMP180_RX_QUEUE_SIZE 10
#define BMP180_TASK_PRIORITY 9
Expand Down
2 changes: 1 addition & 1 deletion components/bmp280/bmp280.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#define I2C_FREQ_HZ 1000000 // Max 1MHz for esp-idf

static const char *TAG = "BMP280";
static const char *TAG = "bmp280";

/**
* BMP280 registers
Expand Down
2 changes: 1 addition & 1 deletion components/dht/dht.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
*
*/

static const char *TAG = "DHTxx";
static const char *TAG = "dht";

#if HELPER_TARGET_IS_ESP32
static portMUX_TYPE mux = portMUX_INITIALIZER_UNLOCKED;
Expand Down
2 changes: 1 addition & 1 deletion components/ds18x20/ds18x20.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static portMUX_TYPE mux = portMUX_INITIALIZER_UNLOCKED;
#define PORT_EXIT_CRITICAL portEXIT_CRITICAL()
#endif

static const char *TAG = "DS18x20";
static const char *TAG = "ds18x20";

esp_err_t ds18x20_measure(gpio_num_t pin, ds18x20_addr_t addr, bool wait)
{
Expand Down
2 changes: 1 addition & 1 deletion components/encoder/encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#define CONFIG_RE_BTN_PRESSED_LEVEL 1
#endif

static const char *TAG = "ENCODER";
static const char *TAG = "encoder";
static rotary_encoder_t *encs[CONFIG_RE_MAX] = { 0 };
static const int8_t valid_states[] = { 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0 };
static SemaphoreHandle_t mutex;
Expand Down
10 changes: 5 additions & 5 deletions components/i2cdev/i2cdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <esp_log.h>
#include "i2cdev.h"

static const char *TAG = "I2CDEV";
static const char *TAG = "i2cdev";

typedef struct {
SemaphoreHandle_t lock;
Expand All @@ -24,7 +24,7 @@ typedef struct {
static i2c_port_state_t states[I2C_NUM_MAX];

#define SEMAPHORE_TAKE(port) do { \
if (!xSemaphoreTake(states[port].lock, CONFIG_I2CDEV_TIMEOUT / portTICK_RATE_MS)) \
if (!xSemaphoreTake(states[port].lock, pdMS_TO_TICKS(CONFIG_I2CDEV_TIMEOUT))) \
{ \
ESP_LOGE(TAG, "Could not take port mutex %d", port); \
return ESP_ERR_TIMEOUT; \
Expand Down Expand Up @@ -107,7 +107,7 @@ esp_err_t i2c_dev_take_mutex(i2c_dev_t *dev)

ESP_LOGV(TAG, "[0x%02x at %d] taking mutex", dev->addr, dev->port);

if (!xSemaphoreTake(dev->mutex, CONFIG_I2CDEV_TIMEOUT / portTICK_RATE_MS))
if (!xSemaphoreTake(dev->mutex, pdMS_TO_TICKS(CONFIG_I2CDEV_TIMEOUT)))
{
ESP_LOGE(TAG, "[0x%02x at %d] Could not take device mutex", dev->addr, dev->port);
return ESP_ERR_TIMEOUT;
Expand Down Expand Up @@ -213,7 +213,7 @@ esp_err_t i2c_dev_read(const i2c_dev_t *dev, const void *out_data, size_t out_si
i2c_master_read(cmd, in_data, in_size, I2C_MASTER_LAST_NACK);
i2c_master_stop(cmd);

res = i2c_master_cmd_begin(dev->port, cmd, CONFIG_I2CDEV_TIMEOUT / portTICK_RATE_MS);
res = i2c_master_cmd_begin(dev->port, cmd, pdMS_TO_TICKS(CONFIG_I2CDEV_TIMEOUT));
if (res != ESP_OK)
ESP_LOGE(TAG, "Could not read from device [0x%02x at %d]: %d", dev->addr, dev->port, res);

Expand All @@ -240,7 +240,7 @@ esp_err_t i2c_dev_write(const i2c_dev_t *dev, const void *out_reg, size_t out_re
i2c_master_write(cmd, (void *)out_reg, out_reg_size, true);
i2c_master_write(cmd, (void *)out_data, out_size, true);
i2c_master_stop(cmd);
res = i2c_master_cmd_begin(dev->port, cmd, CONFIG_I2CDEV_TIMEOUT / portTICK_RATE_MS);
res = i2c_master_cmd_begin(dev->port, cmd, pdMS_TO_TICKS(CONFIG_I2CDEV_TIMEOUT));
if (res != ESP_OK)
ESP_LOGE(TAG, "Could not write to device [0x%02x at %d]: %d", dev->addr, dev->port, res);
i2c_cmd_link_delete(cmd);
Expand Down
2 changes: 1 addition & 1 deletion components/ina219/ina219.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#define I2C_FREQ_HZ 1000000 // Max 1 MHz for esp-idf, but supports up to 2.56 MHz

static const char *TAG = "INA219";
static const char *TAG = "ina219";

#define REG_CONFIG 0
#define REG_SHUNT_U 1
Expand Down
2 changes: 1 addition & 1 deletion components/ina260/ina260.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#define I2C_FREQ_HZ 400000 // no more than 400 kHz, otherwise enabling HS mode on the chip is required

static const char *TAG = "INA260";
static const char *TAG = "ina260";

#define REG_CONFIG 0
#define REG_CURRENT 1
Expand Down
2 changes: 1 addition & 1 deletion components/ina3221/ina3221.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <esp_idf_lib_helpers.h>
#include "ina3221.h"

static const char *TAG = "INA3221";
static const char *TAG = "ina3221";

#define I2C_FREQ_HZ 1000000 // Max 1MHz for esp-idf, but device supports up to 2.44Mhz

Expand Down
2 changes: 1 addition & 1 deletion components/max31725/max31725.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <esp_idf_lib_helpers.h>
#include "max31725.h"

static const char *TAG = "MAX31725";
static const char *TAG = "max31725";

static const float t_lsb = 0.00390625;

Expand Down
2 changes: 1 addition & 1 deletion components/max7219/max7219.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include "max7219_priv.h"

static const char *TAG = "MAX7219";
static const char *TAG = "max7219";

#define CLOCK_SPEED_HZ (10000000) // 10 MHz

Expand Down
2 changes: 1 addition & 1 deletion components/mcp23008/mcp23008.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#define BIT_IOCON_DISSLW 4
#define BIT_IOCON_SREAD 5

static const char *TAG = "MCP23008";
static const char *TAG = "mcp23008";

#define CHECK(x) do { esp_err_t __; if ((__ = x) != ESP_OK) return __; } while (0)
#define CHECK_ARG(VAL) do { if (!(VAL)) return ESP_ERR_INVALID_ARG; } while (0)
Expand Down
2 changes: 1 addition & 1 deletion components/mcp23x17/mcp23x17.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <esp_idf_lib_helpers.h>
#include "mcp23x17.h"

static const char *TAG = "MCP23x17";
static const char *TAG = "mcp23x17";

#define I2C_FREQ_HZ 1000000 // Max 1MHz for esp-idf, but device supports up to 1.7Mhz

Expand Down
2 changes: 1 addition & 1 deletion components/mcp342x/mcp342x.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#define I2C_FREQ_HZ 400000 // 400kHz

static const char *TAG = "MCP342x";
static const char *TAG = "mcp342x";

#define BV(x) (1 << (x))

Expand Down
2 changes: 1 addition & 1 deletion components/mcp4725/mcp4725.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <esp_idf_lib_helpers.h>
#include "mcp4725.h"

static const char *TAG = "MCP4725";
static const char *TAG = "mcp4725";

#define I2C_FREQ_HZ 1000000 // Max 1MHz for esp-idf, but device supports up to 3.4Mhz

Expand Down
2 changes: 1 addition & 1 deletion components/mcp960x/mcp960x.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#define I2C_FREQ_HZ 100000 // 100 KHz

static const char *TAG = "MCP960x";
static const char *TAG = "mcp960x";

#define REG_T_HOT 0x00
#define REG_T_DELTA 0x01
Expand Down
2 changes: 1 addition & 1 deletion components/mcp9808/mcp9808.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <math.h>
#include <esp_log.h>

static const char *TAG = "MCP9808";
static const char *TAG = "mcp9808";

#define I2C_FREQ_HZ 400000 // 400 kHz

Expand Down
2 changes: 1 addition & 1 deletion components/ms5611/ms5611.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#define CHECK(x) do { esp_err_t __; if ((__ = x) != ESP_OK) return __; } while (0)
#define CHECK_ARG(VAL) do { if (!(VAL)) return ESP_ERR_INVALID_ARG; } while (0)

static const char *TAG = "MS5611";
static const char *TAG = "ms5611";

static inline esp_err_t send_command(ms5611_t *dev, uint8_t cmd)
{
Expand Down
2 changes: 1 addition & 1 deletion components/pca9685/pca9685.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
#define CHECK_ARG_LOGE(VAL, msg, ...) do { if (!(VAL)) { ESP_LOGE(TAG, msg, ## __VA_ARGS__); return ESP_ERR_INVALID_ARG; } } while (0)
#define CHECK(x) do { esp_err_t __; if ((__ = x) != ESP_OK) return __; } while (0)

static const char *TAG = "PCA9685";
static const char *TAG = "pca9685";

inline static uint32_t round_div(uint32_t x, uint32_t y)
{
Expand Down
2 changes: 1 addition & 1 deletion components/pcf8591/pcf8591.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <esp_idf_lib_helpers.h>
#include "pcf8591.h"

static const char *TAG = "PCF8591";
static const char *TAG = "pcf8591";

#define I2C_FREQ_HZ 100000

Expand Down
2 changes: 1 addition & 1 deletion components/qmc5883l/qmc5883l.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#define MASK_MODE 0xfe
#define MASK_ODR 0xf3

static const char *TAG = "QMC5883L";
static const char *TAG = "qmc5883l";

#define CHECK(x) do { esp_err_t __; if ((__ = x) != ESP_OK) return __; } while (0)
#define CHECK_ARG(VAL) do { if (!(VAL)) return ESP_ERR_INVALID_ARG; } while (0)
Expand Down
2 changes: 1 addition & 1 deletion components/rda5807m/rda5807m.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ static const band_limit_t band_limits[] = {
[RDA5807M_BAND_50_76] = {50000, 76000}
};

static const char *TAG = "RDA5807M";
static const char *TAG = "rda5807m";

static inline esp_err_t read_register_nolock(rda5807m_t *dev, uint8_t reg, uint16_t *val)
{
Expand Down
2 changes: 1 addition & 1 deletion components/sgp40/sgp40.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#define I2C_FREQ_HZ 400000

static const char *TAG = "SGP40";
static const char *TAG = "sgp40";

#define CMD_SOFT_RESET 0x0600 // 00 06
#define CMD_FEATURESET 0x2f20 // 20 2f
Expand Down
2 changes: 1 addition & 1 deletion components/sht3x/sht3x.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#define I2C_FREQ_HZ 1000000 // 1MHz

const char *TAG = "SHT3x";
const char *TAG = "sht3x";

#define SHT3X_STATUS_CMD 0xF32D
#define SHT3X_CLEAR_STATUS_CMD 0x3041
Expand Down
2 changes: 1 addition & 1 deletion components/si7021/si7021.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#define I2C_FREQ_HZ 400000 // 400kHz

static const char *TAG = "SI7021";
static const char *TAG = "si7021";

#define DELAY_MS 50 // fixed delay

Expand Down
2 changes: 1 addition & 1 deletion components/tca9548/tca9548.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#define I2C_FREQ_HZ 100000 // 100kHz

static const char *TAG = "TCA9548";
static const char *TAG = "tca9548";

#define BYTE_TO_BINARY_PATTERN "%c%c%c%c%c%c%c%c"
#define BYTE_TO_BINARY(byte) \
Expand Down
2 changes: 1 addition & 1 deletion components/tda74xx/tda74xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#define I2C_FREQ_HZ 100000 // 100kHz

static const char *TAG = "TDA74xx";
static const char *TAG = "tda74xx";

#define REG_INPUT_SELECTOR 0x00
#define REG_INPUT_GAIN 0x01
Expand Down
2 changes: 1 addition & 1 deletion components/tsl2561/tsl2561.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#define I2C_FREQ_HZ 400000 // 400kHz

static const char *TAG = "TSL2561";
static const char *TAG = "tsl2561";

// Registers
#define TSL2561_REG_COMMAND 0x80
Expand Down
2 changes: 1 addition & 1 deletion components/tsl2591/tsl2591.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#define I2C_FREQ_HZ 400000 // 400kHz

static const char *TAG = "TSL2591";
static const char *TAG = "tsl2591";

// Registers
#define TSL2591_REG_COMMAND 0x80
Expand Down
2 changes: 1 addition & 1 deletion components/tsl4531/tsl4531.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#define I2C_FREQ_HZ 400000

static const char *TAG = "TSL4531";
static const char *TAG = "tsl4531";

// Registers
#define TSL4531_REG_COMMAND 0x80
Expand Down
4 changes: 2 additions & 2 deletions components/tsys01/tsys01.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
#include <freertos/task.h>
#include "tsys01.h"

#define I2C_FREQ_HZ 1000000 // 1MHz (max
#define I2C_FREQ_HZ 1000000 // 1MHz

static const char *TAG = "TSYS01";
static const char *TAG = "tsys01";

#define CMD_RESET 0x1e
#define CMD_START 0x48
Expand Down

0 comments on commit b6b9b02

Please sign in to comment.