diff --git a/components/branch/src/branch.c b/components/branch/src/branch.c index 788108dd3b9273f5ae7bcc300be126038fd30022..34fd24c499e2b7c046f374510e337a14e89a90c3 100644 --- a/components/branch/src/branch.c +++ b/components/branch/src/branch.c @@ -7,7 +7,7 @@ #include "mqtt_client.h" static const char *TAG = "Branch"; // Logging tag -static const char *ID = "#X"; // Branch ID +static const char *ID = "#13"; // Branch ID static i2c_port_t i2c_num = I2C_NUM_1; // I2C port static const uint8_t ina_bus_a = INA233_ADDRESS_40; // I2C address INA233 @@ -746,11 +746,11 @@ esp_err_t branch_init_entity() // Set default LED intensity entity.led_intensity = 0.5; - ESP_ERROR_CHECK(init_gpio()); - ESP_ERROR_CHECK(init_pwm()); - ESP_ERROR_CHECK(init_owb()); - ESP_ERROR_CHECK(init_i2c()); - ESP_ERROR_CHECK(init_telemetry()); + init_gpio(); + init_pwm(); + init_owb(); + init_i2c(); + init_telemetry(); // Power flow visualization task xTaskCreate(led_pwrflow_task, "led_pwrflow_task", 2048, NULL, 5, &pwrflow_task_handle); @@ -869,7 +869,7 @@ esp_err_t branch_mqtt_post(void *client) { mqtt_client = (esp_mqtt_client_handle_t)client; char data[64]; - sprintf(data,"%10s A: %7.1f mA [%4.2f V]\tB: %7.1f mA [%4.2f V]",ID,entity.bus_a.current,entity.bus_a.voltage,entity.bus_b.current,entity.bus_b.voltage); + sprintf(data,"%3s A: %7.1f mA [%4.2f V]\tB: %7.1f mA [%4.2f V]",ID,entity.bus_a.current,entity.bus_a.voltage,entity.bus_b.current,entity.bus_b.voltage); esp_mqtt_client_publish(mqtt_client, mqtt_topic_pub, data, 0, CONFIG_MQTT_QOS_LEVEL, 0); ESP_LOGD(TAG, "Outgoing MQTT message: %s\n%s", mqtt_topic_pub, data); return ESP_OK; diff --git a/components/data_center/src/data_center.c b/components/data_center/src/data_center.c index 25b16d065a308c4c15a0efad47b700d92fef57dc..e41d65d648bcabcd3eac5d9df1c90e5de529e816 100644 --- a/components/data_center/src/data_center.c +++ b/components/data_center/src/data_center.c @@ -391,6 +391,7 @@ esp_err_t init_i2c() conf.scl_pullup_en = GPIO_PULLUP_DISABLE; ESP_LOGD(TAG, "clk_speed %d", I2C_MASTER_FREQ_HZ); + conf.clk_flags = 0; conf.master.clk_speed = I2C_MASTER_FREQ_HZ; ESP_LOGD(TAG, "i2c_param_config %d", conf.mode); ESP_ERROR_CHECK(i2c_param_config(i2c_num, &conf)); @@ -482,12 +483,12 @@ esp_err_t datacenter_init_entity() entity.led_intensity = 0.5; entity.server_load = 0.25; - ESP_ERROR_CHECK(init_gpio()); - ESP_ERROR_CHECK(init_pwm()); - ESP_ERROR_CHECK(init_owb()); - ESP_ERROR_CHECK(init_i2c()); - ESP_ERROR_CHECK(init_spi()); - ESP_ERROR_CHECK(init_telemetry()); + init_gpio(); + init_pwm(); + init_owb(); + init_i2c(); + init_spi(); + init_telemetry(); // Entity main tasks xTaskCreate(entity_main_tasks, "entity_main_task", 2048, NULL, 4, &entity_task_handle); diff --git a/components/ec_station/src/ec_station.c b/components/ec_station/src/ec_station.c index cbc6cbdf641b5dea3b84fdf2d24dfb3d81a74601..18a30c253d8cb929287714794ae7452d36e2f7d7 100644 --- a/components/ec_station/src/ec_station.c +++ b/components/ec_station/src/ec_station.c @@ -495,6 +495,7 @@ esp_err_t init_i2c() conf.scl_pullup_en = GPIO_PULLUP_DISABLE; ESP_LOGD(TAG, "clk_speed %d", I2C_MASTER_FREQ_HZ); + conf.clk_flags = 0; conf.master.clk_speed = I2C_MASTER_FREQ_HZ; ESP_LOGD(TAG, "i2c_param_config %d", conf.mode); ESP_ERROR_CHECK(i2c_param_config(i2c_num, &conf)); @@ -609,12 +610,12 @@ esp_err_t ecstation_init_entity() // Set default LED intensity entity.led_intensity = 0.5; - ESP_ERROR_CHECK(init_gpio()); - ESP_ERROR_CHECK(init_pwm()); - ESP_ERROR_CHECK(init_owb()); - ESP_ERROR_CHECK(init_i2c()); - ESP_ERROR_CHECK(init_spi()); - ESP_ERROR_CHECK(init_telemetry()); + init_gpio(); + init_pwm(); + init_owb(); + init_i2c(); + init_spi(); + init_telemetry(); ESP_ERROR_CHECK(init_rfid()); // Entity main tasks diff --git a/components/factory/src/factory.c b/components/factory/src/factory.c index fbb5f348568a9ce0042306beb210d23efdfd6853..ec062c82cc7e96dd746956bfcf9e91aff7f51369 100644 --- a/components/factory/src/factory.c +++ b/components/factory/src/factory.c @@ -419,6 +419,7 @@ esp_err_t init_i2c() conf.scl_pullup_en = GPIO_PULLUP_DISABLE; ESP_LOGD(TAG, "clk_speed %d", I2C_MASTER_FREQ_HZ); + conf.clk_flags = 0; conf.master.clk_speed = I2C_MASTER_FREQ_HZ; ESP_LOGD(TAG, "i2c_param_config %d", conf.mode); ESP_ERROR_CHECK(i2c_param_config(i2c_num, &conf)); @@ -468,8 +469,8 @@ esp_err_t init_telemetry() float INA_R_SHUNT = 0.100; float INA_I_MAX = 0.55; - ESP_ERROR_CHECK(ina233_init(i2c_num, ina_grid)); - ESP_ERROR_CHECK(ina233_setCalibration(ina_grid, INA_R_SHUNT, INA_I_MAX)); + ina233_init(i2c_num, ina_grid); + ina233_setCalibration(ina_grid, INA_R_SHUNT, INA_I_MAX); return ESP_OK; } @@ -513,12 +514,12 @@ esp_err_t factory_init_entity() // Set default Factory load entity.factory_load = 0.2; - ESP_ERROR_CHECK(init_gpio()); - ESP_ERROR_CHECK(init_pwm()); - ESP_ERROR_CHECK(init_owb()); - ESP_ERROR_CHECK(init_i2c()); - ESP_ERROR_CHECK(init_touch()); - ESP_ERROR_CHECK(init_telemetry()); + init_gpio(); + init_pwm(); + init_owb(); + init_i2c(); + init_touch(); + init_telemetry(); // Entity main tasks xTaskCreate(entity_main_tasks, "entity_main_task", 2048, NULL, 4, &entity_task_handle); diff --git a/components/hospital/src/hospital.c b/components/hospital/src/hospital.c index bdc4470c841e4bddb418d8bf615f02c09c9fc2d4..afa85f6a5a7f99bd5818334751c4d9cfd49cef7f 100644 --- a/components/hospital/src/hospital.c +++ b/components/hospital/src/hospital.c @@ -349,6 +349,7 @@ esp_err_t init_i2c() conf.scl_pullup_en = GPIO_PULLUP_DISABLE; ESP_LOGD(TAG, "clk_speed %d", I2C_MASTER_FREQ_HZ); + conf.clk_flags = 0; conf.master.clk_speed = I2C_MASTER_FREQ_HZ; ESP_LOGD(TAG, "i2c_param_config %d", conf.mode); ESP_ERROR_CHECK(i2c_param_config(i2c_num, &conf)); @@ -424,11 +425,11 @@ esp_err_t hospital_init_entity() // Set default LED intensity entity.led_intensity = 0.5; - ESP_ERROR_CHECK(init_gpio()); - ESP_ERROR_CHECK(init_pwm()); - ESP_ERROR_CHECK(init_owb()); - ESP_ERROR_CHECK(init_i2c()); - ESP_ERROR_CHECK(init_telemetry()); + init_gpio(); + init_pwm(); + init_owb(); + init_i2c(); + init_telemetry(); // Entity main tasks xTaskCreate(entity_main_tasks, "entity_main_task", 2048, NULL, 4, &entity_task_handle); diff --git a/components/house/src/house.c b/components/house/src/house.c index b7935d3c84b6da9b61d42b4bc9c73abcf0c2be54..ec74d19ef5c161a5f97a44539272e6bbc9f9df63 100644 --- a/components/house/src/house.c +++ b/components/house/src/house.c @@ -543,6 +543,7 @@ esp_err_t init_i2c() conf.scl_pullup_en = GPIO_PULLUP_DISABLE; ESP_LOGD(TAG, "clk_speed %d", I2C_MASTER_FREQ_HZ); + conf.clk_flags = 0; conf.master.clk_speed = I2C_MASTER_FREQ_HZ; ESP_LOGD(TAG, "i2c_param_config %d", conf.mode); ESP_ERROR_CHECK(i2c_param_config(i2c_num, &conf)); @@ -707,15 +708,15 @@ esp_err_t house_init_entity() // Set default LED intensity entity.led_intensity = 0.5; - ESP_ERROR_CHECK(init_gpio()); - ESP_ERROR_CHECK(init_pwm()); - ESP_ERROR_CHECK(init_owb()); - ESP_ERROR_CHECK(init_i2c()); - ESP_ERROR_CHECK(init_spi()); - ESP_ERROR_CHECK(init_touch()); - ESP_ERROR_CHECK(init_telemetry()); - ESP_ERROR_CHECK(init_devices()); - ESP_ERROR_CHECK(init_display()); + init_gpio(); + init_pwm(); + init_owb(); + init_i2c(); + init_spi(); + init_touch(); + init_telemetry(); + init_devices(); + init_display(); // Entity main tasks xTaskCreate(entity_main_tasks, "entity_main_task", 2048, NULL, 4, &entity_task_handle); diff --git a/components/power_plant/src/power_plant.c b/components/power_plant/src/power_plant.c index 50d5c2d021133a4e1c78136aaa2150518566ac40..1de54af4ccdcc9d14927309ce7be79b3a89a192c 100644 --- a/components/power_plant/src/power_plant.c +++ b/components/power_plant/src/power_plant.c @@ -393,6 +393,7 @@ esp_err_t init_i2c() conf.scl_pullup_en = GPIO_PULLUP_DISABLE; ESP_LOGD(TAG, "clk_speed %d", I2C_MASTER_FREQ_HZ); + conf.clk_flags = 0; conf.master.clk_speed = I2C_MASTER_FREQ_HZ; ESP_LOGD(TAG, "i2c_param_config %d", conf.mode); ESP_ERROR_CHECK(i2c_param_config(i2c_num, &conf)); @@ -508,13 +509,13 @@ esp_err_t powerplant_init_entity() entity.setpoint_vbus = 190; entity.setpoint_imax = 127; - ESP_ERROR_CHECK(init_gpio()); - ESP_ERROR_CHECK(init_pwm()); - ESP_ERROR_CHECK(init_owb()); - ESP_ERROR_CHECK(init_i2c()); - ESP_ERROR_CHECK(init_spi()); - ESP_ERROR_CHECK(init_touch()); - ESP_ERROR_CHECK(init_telemetry()); + init_gpio(); + init_pwm(); + init_owb(); + init_i2c(); + init_spi(); + init_touch(); + init_telemetry(); // Entity main tasks xTaskCreate(entity_main_tasks, "entity_main_task", 2048, NULL, 4, &entity_task_handle); diff --git a/components/skyscraper/src/skyscraper.c b/components/skyscraper/src/skyscraper.c index af2f6f615efd3f65c8559b65d2c0694b91c4598e..03ae45096759724cef4021cba90fb7620a2296e9 100644 --- a/components/skyscraper/src/skyscraper.c +++ b/components/skyscraper/src/skyscraper.c @@ -431,6 +431,7 @@ esp_err_t init_i2c() conf.scl_pullup_en = GPIO_PULLUP_DISABLE; ESP_LOGD(TAG, "clk_speed %d", I2C_MASTER_FREQ_HZ); + conf.clk_flags = 0; conf.master.clk_speed = I2C_MASTER_FREQ_HZ; ESP_LOGD(TAG, "i2c_param_config %d", conf.mode); ESP_ERROR_CHECK(i2c_param_config(i2c_num, &conf)); @@ -524,11 +525,11 @@ esp_err_t skyscraper_init_entity() // Set default LED intensity entity.led_intensity = 0.5; - ESP_ERROR_CHECK(init_gpio()); - ESP_ERROR_CHECK(init_pwm()); - ESP_ERROR_CHECK(init_owb()); - ESP_ERROR_CHECK(init_i2c()); - ESP_ERROR_CHECK(init_telemetry()); + init_gpio(); + init_pwm(); + init_owb(); + init_i2c(); + init_telemetry(); ESP_ERROR_CHECK(init_ambimate()); // Entity main tasks diff --git a/components/solar_farm/src/solar_farm.c b/components/solar_farm/src/solar_farm.c index 649c874ac8b8eb96dbdef9b2a4937528a45189b6..7d63f7e7c1461c92aab02eb36561d936a541a81a 100644 --- a/components/solar_farm/src/solar_farm.c +++ b/components/solar_farm/src/solar_farm.c @@ -443,6 +443,7 @@ esp_err_t init_i2c() conf.scl_pullup_en = GPIO_PULLUP_DISABLE; ESP_LOGD(TAG, "clk_speed %d", I2C_MASTER_FREQ_HZ); + conf.clk_flags = 0; conf.master.clk_speed = I2C_MASTER_FREQ_HZ; ESP_LOGD(TAG, "i2c_param_config %d", conf.mode); ESP_ERROR_CHECK(i2c_param_config(i2c_num, &conf)); @@ -531,13 +532,13 @@ esp_err_t solarfarm_init_entity() // Set default setpoints entity.setpoint_imax = 127; - ESP_ERROR_CHECK(init_gpio()); - ESP_ERROR_CHECK(init_pwm()); - ESP_ERROR_CHECK(init_owb()); - ESP_ERROR_CHECK(init_i2c()); - ESP_ERROR_CHECK(init_spi()); - ESP_ERROR_CHECK(init_pulse_counter()); - ESP_ERROR_CHECK(init_telemetry()); + init_gpio(); + init_pwm(); + init_owb(); + init_i2c(); + init_spi(); + init_pulse_counter(); + init_telemetry(); // Entity main tasks xTaskCreate(entity_main_tasks, "entity_main_task", 2048, NULL, 4, &entity_task_handle); diff --git a/components/stadium/src/stadium.c b/components/stadium/src/stadium.c index c8d55f454906ca587b488b7cbf0df2ec640f1b3c..4e9b544913a57d82a79e4ea6eb4b0e0cec6c2783 100644 --- a/components/stadium/src/stadium.c +++ b/components/stadium/src/stadium.c @@ -405,6 +405,7 @@ esp_err_t init_i2c() conf.scl_pullup_en = GPIO_PULLUP_DISABLE; ESP_LOGD(TAG, "clk_speed %d", I2C_MASTER_FREQ_HZ); + conf.clk_flags = 0; conf.master.clk_speed = I2C_MASTER_FREQ_HZ; ESP_LOGD(TAG, "i2c_param_config %d", conf.mode); ESP_ERROR_CHECK(i2c_param_config(i2c_num, &conf)); @@ -555,13 +556,13 @@ esp_err_t stadium_init_entity() // Set default mode entity.mode = 0; - ESP_ERROR_CHECK(init_gpio()); - ESP_ERROR_CHECK(init_pwm()); - ESP_ERROR_CHECK(init_owb()); - ESP_ERROR_CHECK(init_i2c()); - ESP_ERROR_CHECK(init_spi()); - ESP_ERROR_CHECK(init_touch()); - ESP_ERROR_CHECK(init_telemetry()); + init_gpio(); + init_pwm(); + init_owb(); + init_i2c(); + init_spi(); + init_touch(); + init_telemetry(); // Entity main tasks xTaskCreate(entity_main_tasks, "entity_main_task", 2048, NULL, 4, &entity_task_handle); diff --git a/components/substation/src/substation.c b/components/substation/src/substation.c index 10419944322c857591a7b7ae67a4bf4ba5d5fd8d..f353508b565c896f8d9431f65d3762aace301377 100644 --- a/components/substation/src/substation.c +++ b/components/substation/src/substation.c @@ -334,9 +334,9 @@ esp_err_t init_tasks_timer() */ esp_err_t substation_init_entity() { - ESP_ERROR_CHECK(init_gpio()); - ESP_ERROR_CHECK(init_pwm()); - ESP_ERROR_CHECK(init_owb()); + init_gpio(); + init_pwm(); + init_owb(); // Entity main tasks xTaskCreate(entity_main_tasks, "entity_main_task", 2048, NULL, 4, &entity_task_handle); diff --git a/components/supermarket/src/supermarket.c b/components/supermarket/src/supermarket.c index aa84c3e9e0250a6905fd25703593397f738d5c34..79e85969361d4407210b95d14b08eb5dae9d4dce 100644 --- a/components/supermarket/src/supermarket.c +++ b/components/supermarket/src/supermarket.c @@ -535,6 +535,7 @@ esp_err_t init_i2c() conf.scl_pullup_en = GPIO_PULLUP_DISABLE; ESP_LOGD(TAG, "clk_speed %d", I2C_MASTER_FREQ_HZ); + conf.clk_flags = 0; conf.master.clk_speed = I2C_MASTER_FREQ_HZ; ESP_LOGD(TAG, "i2c_param_config %d", conf.mode); ESP_ERROR_CHECK(i2c_param_config(i2c_num, &conf)); @@ -674,14 +675,14 @@ esp_err_t supermarket_init_entity() entity.price.gas = 18.5F; entity.price.grid = 18.5F; - ESP_ERROR_CHECK(init_gpio ()); - ESP_ERROR_CHECK(init_pwm ()); - ESP_ERROR_CHECK(init_owb ()); - ESP_ERROR_CHECK(init_i2c ()); - ESP_ERROR_CHECK(init_spi ()); - ESP_ERROR_CHECK(init_touch()); - ESP_ERROR_CHECK(init_telemetry()); - ESP_ERROR_CHECK(init_display()); + init_gpio(); + init_pwm(); + init_owb(); + init_i2c(); + init_spi(); + init_touch(); + init_telemetry(); + init_display(); // Entity main tasks xTaskCreate(entity_main_tasks, "entity_main_task", 2048, NULL, 4, &entity_task_handle); diff --git a/components/wind_farm/src/wind_farm.c b/components/wind_farm/src/wind_farm.c index 49c7fa761dc47b0681dd6406e64a1e5f434e5620..af4da76d28519a14369cf47f5f20c83c1493fdf7 100644 --- a/components/wind_farm/src/wind_farm.c +++ b/components/wind_farm/src/wind_farm.c @@ -416,6 +416,7 @@ esp_err_t init_i2c() conf.scl_pullup_en = GPIO_PULLUP_DISABLE; ESP_LOGD(TAG, "clk_speed %d", I2C_MASTER_FREQ_HZ); + conf.clk_flags = 0; conf.master.clk_speed = I2C_MASTER_FREQ_HZ; ESP_LOGD(TAG, "i2c_param_config %d", conf.mode); ESP_ERROR_CHECK(i2c_param_config(i2c_num, &conf)); @@ -531,13 +532,13 @@ esp_err_t windfarm_init_entity() // Set default setpoints entity.setpoint_imax = 127; - ESP_ERROR_CHECK(init_gpio()); - ESP_ERROR_CHECK(init_pwm()); - ESP_ERROR_CHECK(init_owb()); - ESP_ERROR_CHECK(init_i2c()); - ESP_ERROR_CHECK(init_spi()); - ESP_ERROR_CHECK(init_touch()); - ESP_ERROR_CHECK(init_telemetry()); + init_gpio(); + init_pwm(); + init_owb(); + init_i2c(); + init_spi(); + init_touch(); + init_telemetry(); // Entity main tasks xTaskCreate(entity_main_tasks, "entity_main_task", 2048, NULL, 4, &entity_task_handle);