主题中讨论的其他器件:HDC2080
您好!
我使用 DMM_154sensor_remote_display_oad_lpstk_app 示例程序作为项目的基础。 我注意到、发送到收集器的 HDC2080温度传感器数据没有小数位。 我查看了将 HDC2080温度传感器读取为浮点值的代码。 如果我没有记错、则浮点数大小为5。
lpstk.c
//get last temp float Lpstk_getTemperature() { return lpstkSensors.temperature; }
然后、在 sensor.c 中、浮点被类型转换为 uint16_t、如果我没有弄错、则大小为2。 因此、这可能是删除小数位数的原因。 我们需要温度小数位数。 类型转换为 uin16_t 的原因是集电极 csf.c CUI_statusLinePrintf()无法以浮点格式打印吗?
传感器.c
static void readSensors(void) { #if defined(TEMP_SENSOR) /* Read the temp sensor values */ tempSensor.ambienceTemp = Ssf_readTempSensor(); tempSensor.objectTemp = tempSensor.ambienceTemp; #endif #ifdef LPSTK Lpstk_Accelerometer accel; humiditySensor.temp = (uint16_t)Lpstk_getTemperature(); humiditySensor.humidity = (uint16_t)Lpstk_getHumidity();
-kel