ESPNOW + WiFi

This commit is contained in:
2025-07-28 16:55:30 -04:00
parent b26be41154
commit f054ba653f

View File

@@ -20,9 +20,11 @@ static void mqtt_publish_task(void *arg) {
//float tsens_value = 0.0f;
//temperature_sensor_get_celsius(temp_sensor, &tsens_value);
ESP_LOGW("ESP32-C3", "Temperature value %.02f ℃", tsens_value);
char temp_str[6];
snprintf(temp_str, sizeof(temp_str), "%.02f", tsens_value);
// Publish a message every 5 seconds
esp_mqtt_client_publish(mqtt_client, "/bitrider/temp", (char)tsens_value, 0, 1, 0);
esp_mqtt_client_publish(mqtt_client, "/bitrider/temp", temp_str, 0, 1, 0);
vTaskDelay(pdMS_TO_TICKS(1000));
ESP_LOGI(MQTT_TAG, "Called task to publish topic /bitrider/temp");
}