This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] LAUNCHLL-CC26X2R1:display_printf显示2位小数,CUI显示在循环中

Guru**** 2466670 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/zigbee-thread-group/zigbee-and-thread/f/zigbee-thread-forum/1097920/launchxl-cc26x2r1-display_printf-to-show-2-decimals-and-cui-to-show-on-loop

部件号:LAUNCHTXL-CC26X2R1

您好,

我正在尝试从8 l 温度传感器获取数据。 我尝试使用:

display_printf (display,0,0,"%.2lf",result);

所需输出为26.99 ,但实际输出始终为26.5999。 (有4位小数)

在项目.cfg中,将写入此行,但仍不工作:

//System.extendedFormats ='%f%$L%$S%$F';

此外,我有此代码是为了在CUI中显示传感器接收到的值。 我想知道我如何才能做到这一点当我进入这个子菜单时,温度会显示出来,但它会在循环中自我更新。 此时,我必须在菜单中再次按下才能看到另一个温度值。

静态void uiActionSetSensorPresencia (const char _input,char*_plines[3],cui_cursorInfo_t*_pCurInfo)

   如果(cuI_item_intercept _start ==_input){

       字符温度[8];
       char tmpEntera[8]=".";
       char tmpDouble [8];
       双精度值= readSensor();

       doubleToString (value,tmp,tmpEntera,tmpDouble);

       strncpy (_plines[0],"Mostrando valores:",MAX_MENU_LINE_LEN);
       strncpy (_plines[1],tmp,MAX_MENU_LINE_LEN);

   }

}

谢谢你。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    嘿,Dani,

    是否可以尝试将所有双精度类型切换为浮动? 以及在相同操作中使用这些值的任何整数,请确保将它们转换为浮点。

    确保项目属性上的编译器选项已启用浮点,默认情况下应启用浮点,但只需确保。

    能否详细解释一下CUI菜单的问题,我不理解。

    此致,

    AB