Skip to content

Wrong data type in FRAME_SENSOR_TYPE_TABLE for Smart Water Xtreme sensors #51

@mereshow

Description

@mereshow

The data type definitions table (FRAME_SENSOR_TYPE_TABLE) for the Smart Water Xtreme sensors in WaspFrameConstantsv15.h are not the same as the definitions (WTR_XTR_TYPE_TABLE) in WtrXtrFrameConstants.h, nor the same shown in the documentation.

For instance, WaspFrameConstantsv15.h says that WTRX_PHEHT_PH_B (140) is an uint8_t (type 0, 1 byte), but both the documentation and WtrXtrFrameConstants.h say that it is a float (type 2, 4 bytes).

The problem this causes: when I create a binary frame and add the values of Smart Water Xtreme sensors (PHEHT and NTU, for instance) like this:

// PHEHT - temperatura
frame.addSensor(WTRX_PHEHT_TC2_B, sensorPHEHT.sensorPHEHT.temperature);
// PHEHT - pH
frame.addSensor(WTRX_PHEHT_PH_B, sensorPHEHT.sensorPHEHT.pH);
// PHEHT - redox
frame.addSensor(WTRX_PHEHT_RX_B, sensorPHEHT.sensorPHEHT.redox);
// NTU - turbidez (NTUs)
frame.addSensor(WTRX_NTU_TN_C, sensorNTU.sensorNTU.turbidityNTU);

It gives the following error when creating the frame:

[FRAME] Error sensor type mismatch for index 140: api says 0 vs user says 2
[FRAME] Error sensor type mismatch for index 145: api says 0 vs user says 2
[FRAME] Error sensor type mismatch for index 181: 1 vs 2

The only solution is using for all float values a field I know is properly defined, such as WTRX_PHEHT_TC2_B, but then the code is misleading.

Analysing WaspFrameConstantsv15.h I think this file is not updated with the Smart Water Xtreme values (they are used for the industrial protocol values, that have different fields).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions