platformio and mysensors for atmega328p on breadboard?



  • Hi all,

    I am new to MySensors, and I have only limited experience with platformio and Arduino programming in general.

    I was able to get the temperature sensor built with a Nano and an NRF24L01+ I had laying around -- worked great! As usual, I used platformio to manage the dependencies and the build (I don't care much for the Arduino editor or library and board manager).

    Now I want to make a version of the same sketch using an atmega328p on a breadboard. I figure it should work as it's the same MCU.

    However, I'm running into a slew of errors, mostly "not declared in this scope." My INO file is identical to the one from the temp sensor tutorial.

    In file included from .piolibdeps/MySensors_ID548/MySensors.h:257:0,
    from rf24_temp/src/tempsensor.ino:38:
    .piolibdeps/MySensors_ID548/core/MyTransport.cpp: In function 'void stInitTransition()':
    .piolibdeps/MySensors_ID548/core/MyTransport.cpp:80:45: error: 'hwReadConfigBlock' was not declared in this scope
    sizeof(transportConfig_t));
    ^
    .piolibdeps/MySensors_ID548/core/MyTransport.cpp: In function 'void stInitUpdate()':
    .piolibdeps/MySensors_ID548/core/MyTransport.cpp:108:61: error: 'hwWriteConfig' was not declared in this scope
    hwWriteConfig(EEPROM_NODE_ID_ADDRESS, (uint8_t)MY_NODE_ID);
    ^
    .piolibdeps/MySensors_ID548/core/MyTransport.cpp: In function 'void stUplinkUpdate()':
    .piolibdeps/MySensors_ID548/core/MyTransport.cpp:232:43: error: 'hwMillis' was not declared in this scope
    _transportSM.lastUplinkCheck = hwMillis();
    ^
    .piolibdeps/MySensors_ID548/core/MyTransport.cpp: In function 'void transportSwitchSM(transportState_t&)':
    .piolibdeps/MySensors_ID548/core/MyTransport.cpp:342:37: error: 'hwMillis' was not declared in this scope
    _transportSM.stateEnter = hwMillis(); // save time
    ^
    .piolibdeps/MySensors_ID548/core/MyTransport.cpp: In function 'uint32_t transportTimeInState()':
    .piolibdeps/MySensors_ID548/core/MyTransport.cpp:347:18: error: 'hwMillis' was not declared in this scope
    return hwMillis() - _transportSM.stateEnter;
    

    So far I've found a few useful links:

    What I've tried (with a pio run target=clean before each attempted build):

    • Adding #include <Arduino.h> to the top of my sketch (nothing changes)
    • Specifying build_flags = -I/path/to/MySensors
    • Specifying lib_ignore = MySensors

    I'm using:

    • MacOS 10.13.1
    • platformio 3.4.1
    • MySensors 2.1.1

    My platformio.ini:

    [env:328p8m]
    platform = atmelavr
    board = 328p8m
    framework = arduino
    upload_protocol = usbasp
    lib_deps = 
        MySensors
        DallasTemperature
    build_flags = -I../MySensors
    lib_ignore = MySensors
    

    Any ideas? Again, this builds fine with the same code but using a nano as the target platform, just won't build for the atmega328p for some reason.

    cc @gerritv @Iyad-Nahas


  • Mod

    Hi, welcome to the mysensors forum.

    About your problem, I'm not entirely sure that is mysensors related. Have you asked in the platformio forum?



  • @gohan -- thanks! Sorry for the delayed response, thought I had email notifications for replies set up, but I guess not. Yeah, I'm not sure either, but I've used platformio for a number of other projects without running into this issue, so I thought there might be people here using MySensors with platformio that could perhaps shed some light.

    I'll ask over at their community forum first, and if I don't have any luck will likely make issues at both repos.

    Link to my cross-post there



  • @n8henrie

    I have installed the mysensors lib from platformio (platformio lib install xx, or something like that)

    And my platformio.ini file look like this:

    [env:pro8MHzatmega328]
    platform = atmelavr
    framework = arduino
    board = pro8MHzatmega328
    

    I think you could remove the build_flags and the lib_ignore



  • Solved with some changes in the Dallas temp library (and platformio 3.5 which allows installing a library from a git url).

    My thread there: https://community.platformio.org/t/platformio-and-mysensors-for-atmega328p-on-breadboard-was-not-declared-in-this-scope/2994/7?u=n8henrie


Log in to reply
 

Suggested Topics

  • 3
  • 2
  • 2
  • 3
  • 4
  • 10

1
Online

11.2k
Users

11.1k
Topics

112.5k
Posts