Skip to content

lengthMultiplikator too low for mobile sensebox #180

Description

@henrymartin1

Hi sensebox/blockly team,
as a arduino newbie I really appreaciated the possibility to use the blockly version to work with the sensebox. However I encountered a bug that took me some time to find and solve.

I was trying to reproduce the project for the mobile sensebox shown here: https://sensebox.de/projects/de/2020-03-09-mobilemessstation#schritt-3-%C3%BCbertragen-der-messwerte-an-die-opensensemap

My setup submitted this string

815f775f2fe6255b001bd228f1,    38.71,2020-10-08T13:44:40Z,8.xxxxxx,47.xxxxxx, 100.00

that was 84 characters long. However, the variable lengthMultiplikator is fixed to 77.

I solved the problem by calculating the lengthMultiplikator in the submitValues function.
Here is the code (be aware that I am not used to writing c code):

sprintf_P(contentBuffer, PSTR("%s,%9.2f,%s,%3.6f,%3.6f,%5.2f\n"), measurements[0].sensorId,
        measurements[0].value, timeStamp, lat, lng, altitude);
      DEBUG2("lat: "); DEBUG2(lat); DEBUG2(" long: "); DEBUG(lng);
      // transmit buffer to client
      lengthMultiplikator = strlen(contentBuffer);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions