Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. Understanding, c++ & MySensors lib

Understanding, c++ & MySensors lib

Scheduled Pinned Locked Moved Development
1 Posts 1 Posters 221 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Sergio RiusS Offline
    Sergio RiusS Offline
    Sergio Rius
    wrote on last edited by Sergio Rius
    #1

    In my attempts to become a better C++ (Arduino) developer, so I can make those advanced nodes I'm thinking on, I often dismantle and see inside of big avr projects.
    In case of MyS, I can't understand how, in an archiectural point of view, can work.

    Let me explain: I created a new project in Platformio for ESP8266. Then I took the bare minimum from MyS lib, to be able to debug send a message, and stripped all other content. Even removing the ability for hook setup and loop, removing MyHwHAL and replacing with normal functions.
    So it has a main.ino with setup and loop that calls mysensorscore setup and loop.
    Other files, with content stripped that still remain are main mysensors.h, myconfig.h and hal for 8266. Nothing more. In hal I only leave debug related content, initilizing serial in hwInit() (called in core without conditional inclusion).

    As is, it never compiles. It throws error for two reasons. Core.cpp doesn't see content in hwHal (hwInit, DEBUG macros), and files in hwHal doesn't see the serial macros defined in config.
    I tried 4 and 5 times, with fresh projects and I can't make it work. I even thought it was something with the linux/platformio compiler, so switched to VS+vsmicro and then arduinoIDE without any success.

    Yesterday I took all the content and incorporated "as is" in order of call in the Mysensors.h file, and it compiled. Then I took out all the files one by one to reveal those two avobe problems in cpps.
    Then I took another copy of the bare project and eliminated the mysensors-mysensorscore level. I moved the coding from core to mys.h and it worked well and solved 1 problem. But Still have to reference myconfig in myhwesp8266 for it to see the debug macros.

    I'm sure it's my ignorance, so perhaps someone more expert in avr-c++ can explain me how mys library ignores those problems?

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    7

    Online

    11.7k

    Users

    11.2k

    Topics

    113.0k

    Posts


    Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • MySensors
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular