Menu

Meaning of code

Help
MBB
2025-02-28
2025-02-28
  • MBB

    MBB - 2025-02-28

    I'm using a BME280 Humidity and pressure sensor.

    In the Compensation Formulas there these two line of code :

    v_x1_u32r = (v_x1_u32r < 0 ? 0 : v_x1_u32r)

    v_x1_u32r = (v_x1_u32r > 419430400 ? 419430400 : v_x1_u32r)

    Does anyone know what this means?

     
  • Anobium

    Anobium - 2025-02-28

    Yes, see below.

    There is a library for the BME280. Not working for you? Mike Otte wrote one a while ago. See the demo for BT_BME280_16F1705_V1_00.GCB

    Evan

    v_x1_u32r = (v_x1_u32r < 0 ? 0 : v_x1_u32r)

    Conversion

    if  (v_x1_u32r < 0) then
        v_x1_u32r = 0
     else
        v_x1_u32r = v_x1_u32r
    end if
    

    can be optimised to

    if  v_x1_u32r < 0 then v_x1_u32r = 0
    

    v_x1_u32r = (v_x1_u32r > 419430400 ? 419430400 : v_x1_u32r)

    Conversion

    if (v_x1_u32r > 419430400) Then
        v_x1_u32r = 419430400
    else
        v_x1_u32r = v_x1_u32r;
    End If
    

    can be optimised to

    if (v_x1_u32r > 419430400) Then  v_x1_u32r = 419430400
    
     
  • MBB

    MBB - 2025-02-28

    Thanks!

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.