2019-08-01 at 2:55 AM #12990
I have quite some trouble to enable debugging. In the header files (.h) of the modular sensors library you can enable debugging by uncommenting a debugging statement. However working form platformIO and using lib_deps = EnviroDIY_ModularSensors, I am getting puzzled how to properly adjust header files. If I use a cloned version of the Modular sensor library and adjust header files the compilation terminates because it cannot find all library dependencies.
I would like to enable debugging for ThingSpeakPublisher.h and Sodaq2GBeeR6.h.
Any help would be greatly appreciated
2019-08-01 at 10:00 AM #12991
You can also enable all of the debugging using a build flag in your platformio.ini. The result is exactly the same as if you un-comment the line in the header. You can add flags for any (or all) of the different modules.12345678910build_flags =-DSDI12_EXTERNAL_PCINT-DNEOSWSERIAL_EXTERNAL_PCINT-DMQTT_MAX_PACKET_SIZE=240-DTINY_GSM_RX_BUFFER=512-DTINY_GSM_YIELD_MS=2-DMS_DATAPUBLISHERBASE_DEBUG-DMS_DATAPUBLISHERBASE_DEBUG-DMS_SODAQ2GBEER6_DEBUG-DMS_THINGSPEAKPUBLISHER_DEBUG
There also seems to be a bug in the very latest PlatformIO (4.0.0) when installing library dependencies. For some reason when I create a new project, add EnviroDIY_ModularSensors to my dependencies, and then try to compile, the library dependency finder doesn’t correctly find and install of of the dependencies during the first build. If I manually install the library using
pio lib install EnviroDIY_ModularSensors
before building, it finds everything perfectly.
2019-08-01 at 10:22 AM #12992
2019-08-01 at 10:24 AM #12993
Oh, and just to note about those other build flags:
-DSDI12_EXTERNAL_PCINT – this tells the library that you don’t want the SDI-12 library to try to monopolize the interrupts on an AVR board, which is required to make it “play nice” with the other libraries. You absolutely must set this because the SDI-12 library is a dependency of ModularSensors (even if you’re not using any SDI-12 sensors)
-DNEOSWSERIAL_EXTERNAL_PCINT – this does the same thing to NeoSoftwareSerial. You only need this if you’re actually using that library, though it makes no difference if you define it but don’t use that library.
-DMQTT_MAX_PACKET_SIZE=240 tells the MQTT library (PubSubClient) you need a bigger buffer for the outgoing request. The ThingSpeak publisher is the only one that uses MQTT (so far). I put it at 240 characters, which should be plenty long enough to send 8 fields to ThingSpeak (the maximum that ThingSpeak accepts at once). If you’re only using a few fields you could omit this flag, which would save you a tiny big of RAM, but be cautious because the MQTT library just won’t send the if the request length exceeds the buffer length.
-DTINY_GSM_RX_BUFFER=512 – This is in the examples, but it really only matters if you’re using an ESP8266, AI Thinker, or Neoway M590. Don’t define it and save some some RAM with the GPRSBee.
2019-08-01 at 10:40 AM #12994
2019-08-02 at 8:04 AM #12995
Thanks for all the information, this was very helpful. If I try to build using the following build flags,123456build_flags =-DSDI12_EXTERNAL_PCINT-DNEOSWSERIAL_EXTERNAL_PCINT-DMQTT_MAX_PACKET_SIZE=240-DMS_DATAPUBLISHERBASE_DEBUG-DMS_SODAQ2GBEER6_DEBUG
I get the following error.12Archiving .pio\build\mayfly\libFrameworkArduino.a*** [.pio\build\mayfly\firmware.elf] Implicit dependency <code>C:\users\moist\.platformio\platforms\atmelavr\builder\this' not found, needed by target</code>.pio\build\mayfly\firmware.elf'.
It does build without the debugging options. Maybe I should not add a second error, but if I drop the DMS_SODAQ2GBEER6_DEBUG and replace it for the DMS_THINGSPEAKPUBLISHER_DEBUG, I get a build error because of a redeclaration of ‘uint32_t start’1234567891011121314#define MS_START_DEBUG_TIMER uint32_t start = millis();^.pio\libdeps\mayfly\EnviroDIY_ModularSensors_ID1648\src\publishers\ThingSpeakPublisher.cpp:214:5: note: in expansion of macro 'MS_START_DEBUG_TIMER'MS_START_DEBUG_TIMER^.pio\libdeps\mayfly\EnviroDIY_ModularSensors_ID1648\src/ModSensorDebugger.h:73:39: note: 'uint32_t start' previously declared here#define MS_START_DEBUG_TIMER uint32_t start = millis();^.pio\libdeps\mayfly\EnviroDIY_ModularSensors_ID1648\src\publishers\ThingSpeakPublisher.cpp:190:5: note: in expansion of macro 'MS_START_DEBUG_TIMER'MS_START_DEBUG_TIMER;^<command-line>:0:29: warning: ISO C++11 requires whitespace after the macro name*** [.pio\build\mayfly\libb4a\EnviroDIY_ModularSensors_ID1648\publishers\ThingSpeakPublisher.cpp.o] Error 1
Any help would be greatly appreciated.
2019-08-05 at 5:11 PM #12999
I’m sorry I’ve not responded. I’m honestly baffled by the errors.
Could you show your whole ini and a shot of the contents of your .pio/libdeps/mayfly folder?
2019-08-06 at 6:53 AM #13000
I have been doing some testing to better understand what is happening. I first tried to build and compile the same example in my deployments folder, that I made during the Learn EnviroDIY Programming tutorial (which was great!). In that project folder I have much less errors. Apparently, I didn’t made a new project folder with the correct settings in the project wizard (through home, new project). After starting a new project folder with correct settings I am able to successfully build an compile the example using the MS_SODAQ2GBEER6_DEBUG build flag. I am a novice in PlatformIO, I just made a mistake somewhere in the process of making a new project folder. Still, if I add DMS_THINGSPEAKPUBLISHER_DEBUG build flag, the build error described above still exist (because of a redeclaration of ‘uint32_t start’).
below you find the ini file.1234567891011121314151617181920[platformio]description = ModularSensors example sending data to ThingSpeak[env:mayfly]monitor_speed = 115200board = mayflyplatform = atmelavrframework = arduinolib_ldf_mode = deep+lib_ignore = RTCZerobuild_flags =-DSDI12_EXTERNAL_PCINT-DNEOSWSERIAL_EXTERNAL_PCINT-DMQTT_MAX_PACKET_SIZE=240-DMS_DATAPUBLISHERBASE_DEBUG-DMS_SODAQ2GBEER6_DEBUG; this enables debugging the GPRSBee; -DMS_THINGSPEAKPUBLISHER_DEBUG; this enables debugging the thingspeaklib_deps =EnviroDIY_ModularSensors
2019-08-06 at 12:28 PM #13001
I found the issue with the ThingSpeakDebugger. It’s now been fixed. It might take until tomorrow before PlatformIO “sees” the new version though.
To update your libraries in your current project:
– Open a new terminal in your project in Atom or go to the Terminal pane in VSCode
pio lib update
– all your libraries for the project should be updated. Watch for ModularSensors to move from 0.23.3 to 0.23.4.
If you’re feeling very impatient and don’t want to wait for the PlatformIO registries to catch the 0.23.4 update, you can uninstall the registered version of ModularSensors and install it from git instead:
– Open a new terminal in your project
– Uninstall ModularSensors by typing:
pio lib uninstall EnviroDIY_ModularSensors
– Open your platformio.ini file in your project
– In the lib_deps section, replace
– Save the platformio.ini
– “Clean” out any pre-compiled library bits by hitting the trash can button in Atom, or going to project tasks > clean in VSCode
– Re-compile and upload your program
2019-08-13 at 3:23 AM #13064
Thanks a lot, ThingSpeakDebugger is working!
- You must be logged in to reply to this topic.