feat(pico-sensor): send sensor values on get-measurement mqtt messages
This commit is contained in:
@@ -132,12 +132,17 @@ static void MqttTask(void *pv) {
|
||||
McuLog_error("failed publishing sensor values");
|
||||
}
|
||||
}
|
||||
vTaskDelay(pdMS_TO_TICKS(1000));
|
||||
vTaskDelay(pdMS_TO_TICKS(10000));
|
||||
} /* for */
|
||||
}
|
||||
|
||||
static void MyMqttMessageCallback(topic_ID_e topic, const unsigned char *payload, size_t len) {
|
||||
McuLog_info("MQTT message received, topic: %d, payload: %.*s", topic, (int)len, payload);
|
||||
if (topic==Topic_ID_Send_Measurement) {
|
||||
if (MqttClient_Publish_SensorValues(Sensor_GetTemperature(), Sensor_GetHumidity())!=ERR_OK) {
|
||||
McuLog_error("failed publishing sensor values");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user