MLP and PlatformIO errors

Support forum for MegunoLink
Post Reply
Joe
Posts: 24
Joined: Wed Jun 22, 2016 8:18 am

Sat Mar 11, 2023 9:25 pm

Hi,
how can I use MLP ino code in PlatformIO? Just tried to compile example RequestSingleParameter.ino. Library is installed correctly but I'm getting these errors

Code: Select all

Processing megaatmega2560 (platform: atmelavr; board: megaatmega2560; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/megaatmega2560.html
PLATFORM: Atmel AVR (4.1.0) > Arduino Mega or Mega 2560 ATmega2560 (Mega 2560)
HARDWARE: ATMEGA2560 16MHz, 8KB RAM, 248KB Flash
DEBUG: Current (avr-stub) External (avr-stub, simavr)
PACKAGES:
 - framework-arduino-avr @ 5.1.0
 - toolchain-atmelavr @ 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 6 compatible libraries
Scanning dependencies...
Dependency Graph
|-- MegunoLink @ 1.41.0 
|-- SoftwareSerial @ 1.0
Building in release mode
Compiling .pio\build\megaatmega2560\src\main.cpp.o
Compiling .pio\build\megaatmega2560\lib62a\MegunoLink\ArduinoTimer.cpp.o
Compiling .pio\build\megaatmega2560\lib62a\MegunoLink\BlockParser.cpp.o
Compiling .pio\build\megaatmega2560\lib62a\MegunoLink\CommandDispatcherBase.cpp.o
src\main.cpp: In function 'void setup()':
src\main.cpp:24:57: error: 'Cmd_SetOnTime' was not declared in this scope
   SerialCommandHandler.AddCommand(F("numOnTime.Value"), Cmd_SetOnTime);
                                                         ^~~~~~~~~~~~~
src\main.cpp:24:57: note: suggested alternative: 'GotOnTime'
   SerialCommandHandler.AddCommand(F("numOnTime.Value"), Cmd_SetOnTime);
                                                         ^~~~~~~~~~~~~
                                                         GotOnTime
src\main.cpp:25:58: error: 'Cmd_SetOffTime' was not declared in this scope
   SerialCommandHandler.AddCommand(F("numOffTime.Value"), Cmd_SetOffTime);
                                                          ^~~~~~~~~~~~~~
src\main.cpp:25:58: note: suggested alternative: 'GotOffTime'
   SerialCommandHandler.AddCommand(F("numOffTime.Value"), Cmd_SetOffTime);
                                                          ^~~~~~~~~~~~~~
                                                          GotOffTime
src\main.cpp:26:49: error: 'Cmd_ListParameters' was not declared in this scope
   SerialCommandHandler.AddCommand(F("ListAll"), Cmd_ListParameters);
                                                 ^~~~~~~~~~~~~~~~~~
src\main.cpp:26:49: note: suggested alternative: 'SpecialParameters'
   SerialCommandHandler.AddCommand(F("ListAll"), Cmd_ListParameters);
                                                 ^~~~~~~~~~~~~~~~~~
                                                 SpecialParameters
src\main.cpp: In function 'void loop()':
src\main.cpp:41:49: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     digitalWrite(LED_BUILTIN, (uNow - LastBlink < OnTime) ? HIGH : LOW);
                                ~~~~~~~~~~~~~~~~~^~~~~~~~
src\main.cpp:42:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if ((uNow - LastBlink) > (OnTime + OffTime))
         ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
src\main.cpp:51:5: error: 'RequestParameters' was not declared in this scope
     RequestParameters();
     ^~~~~~~~~~~~~~~~~
src\main.cpp:51:5: note: suggested alternative: 'RequestTimer'
     RequestParameters();
     ^~~~~~~~~~~~~~~~~
     RequestTimer
*** [.pio\build\megaatmega2560\src\main.cpp.o] Error 1
Maybe someone else already solved the problems
philr
Posts: 446
Joined: Mon May 26, 2014 10:58 am

Thu Mar 30, 2023 8:10 am

Hi, where did that example come from?

Cheers
Phil
Joe
Posts: 24
Joined: Wed Jun 22, 2016 8:18 am

Tue Apr 04, 2023 7:31 pm

Hi Phil,
this example comes from your GitHub repository
https://github.com/Megunolink/MLP/tree/ ... eParameter

Joe
Joe
Posts: 24
Joined: Wed Jun 22, 2016 8:18 am

Thu Apr 13, 2023 1:59 pm

Any ideas?
Joe
Posts: 24
Joined: Wed Jun 22, 2016 8:18 am

Thu Apr 27, 2023 7:08 pm

Did anybody made the CommandHandler working with PlatformIO?
philr
Posts: 446
Joined: Mon May 26, 2014 10:58 am

Thu May 11, 2023 7:52 am

Weird, it builds fine using the arduino IDE. did you have any luck with platform IO? I dont have any experience with that one.
strud
Posts: 20
Joined: Sat Nov 18, 2023 6:51 am

Sun Nov 19, 2023 2:08 am

I think that one of the significant differences with PlaformIO and the Arduino IDE is the requirement for forward declarations in PlatformIO or pretty much anywhere outside the Arduino IDE.

So those errors look like the command handler functions are just out of scope. Forward declarations should resolve that.
Post Reply