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
M

matkor

@matkor
About
Posts
10
Topics
4
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How ethernet gateway code can check if is connected with controller?
    M matkor

    Answering one of my own questions.
    On ethernet gateway send() may return true when there is no connected controller, even when there is no ethernet cable plugged in. :/

    Development

  • How ethernet gateway code can check if is connected with controller?
    M matkor

    @matkor said in How ethernet gateway code can check if is connected with controller?:

    1. Is any way to know if controller is connected ?
    2. Is any way to know if send message really reached controller?

    Seems positive send() result means message reached controller when executed on gateway?

    Development

  • How ethernet gateway code can check if is connected with controller?
    M matkor

    Having arduino ethernet gateway I need to send messages with senors values to controller (Home assistant requirement to auto configure sensors).
    With serial gateway simple sending in first iteration of loop:

    	void loop() {
    		if ( ! inital_msgs_sent ) {
    			inputs.sendStates(); 
    			outputs.sendStates();
    			inital_msgs_sent = true;
    

    worked.

    But with ethernet controller loop starts when HA is not yet connected to GW so sent messages do not reach controller :/
    So, how should I fix it?

    1. Is any way to know if controller is connected ?
    2. Is any way to know if controller requested presentation?
    3. Is any way to know if send message really reached controller?

    TIA, regards,

    Development

  • How can one use MyMessage class in library?
    M matkor

    @matkor said in How can one use MyMessage class in library?:

    Switching both clashing functions ( wakeUp1(), wakeUp2() ) to static functions seems to fix linking for me.

    This sees to be deadend as there come more function name clashes, and i suspect linking problems come from magic done by arduino IDE.

    Current hack for me is include in arduino sketch my lib headers after including MySensors:

    #include <MySensors.h>
    #include <MyLib.h>
    

    and than inside library use only:

    #include <core/MySensorsCore.h>
    

    not sure if its right solution, if one has any better please share.

    Development

  • How can one use MyMessage class in library?
    M matkor

    Switching both clashing functions ( wakeUp1(), wakeUp2() ) to static functions seems to fix linking for me.

    diff --git a/hal/architecture/AVR/MyHwAVR.cpp b/hal/architecture/AVR/MyHwAVR.cpp
    index 5a17b063..a018ab35 100644
    --- a/hal/architecture/AVR/MyHwAVR.cpp
    +++ b/hal/architecture/AVR/MyHwAVR.cpp
    @@ -41,7 +41,7 @@ volatile uint8_t _wakeUp2Interrupt  =
     
     static uint32_t sleepRemainingMs = 0ul;
     
    -void wakeUp1(void)
    +void static wakeUp1(void)
     {
            // Disable sleep. When an interrupt occurs after attachInterrupt,
            // but before sleeping the CPU would not wake up.
    @@ -53,7 +53,7 @@ void wakeUp1(void)
                    _wokeUpByInterrupt = _wakeUp1Interrupt;
            }
     }
    -void wakeUp2(void)
    +void static wakeUp2(void)
     {
            sleep_disable();
            detachInterrupt(_wakeUp2Interrupt);
    diff --git a/hal/architecture/NRF5/MyHwNRF5.cpp b/hal/architecture/NRF5/MyHwNRF5.cpp
    index d91a0438..f083a17c 100644
    --- a/hal/architecture/NRF5/MyHwNRF5.cpp
    +++ b/hal/architecture/NRF5/MyHwNRF5.cpp
    @@ -28,11 +28,11 @@ volatile uint8_t _wakeUp1Interrupt =
     volatile uint8_t _wakeUp2Interrupt =
         INVALID_INTERRUPT_NUM; // Interrupt number for wakeUp2-callback.
     
    -void wakeUp1(void) // place to send the interrupts
    +void static wakeUp1(void) // place to send the interrupts
     {
            _wokeUpByInterrupt = _wakeUp1Interrupt;
     }
    -void wakeUp2(void) // place to send the second interrupts
    +void static wakeUp2(void) // place to send the second interrupts
     {
            _wokeUpByInterrupt = _wakeUp2Interrupt;
     }
    
    Development

  • How can one use MyMessage class in library?
    M matkor

    @tekka said in How can one use MyMessage class in library?:

    #define MY_CORE_ONLY

    It solved compiiation errors, but now I have link errors(I have many .cpp/.h files in my lib):

    /tmp/arduino_build_899057/libraries/MyLib/Foo.cpp.o (symbol from plugin): In function `wakeUp1()':(.text+0x0): multiple definition of `wakeUp1()'
    

    Seems same as https://forum.mysensors.org/topic/6084/including-mysensors-h-in-multiple-files .
    I tried:

    #include <core/MySensorsCore.h>
    

    but it fails:

    Alternatives for core/MyMessage.h: []In file included from mytest.ino:13:0:
    ResolveLibrary(core/MyMessage.h)
      -> candidates: []
    
    MyLib/MyLib.h:10:10: fatal error: core/MyMessage.h: No such file or directory
     #include <core/MyMessage.h>
              ^~~~~~~~~~~~~~~~~~
    compilation terminated.
    
    
    Development

  • How can one use MyMessage class in library?
    M matkor

    How can one use MyMessage class in library?

    When I try to

    #include <MySensors.h>
    

    in my library code I get:
    Arduino/libraries/MySensors/MySensors.h:426:2: error: #error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.

    without include I of course get:

    Button.h:13:5: error: 'MyMessage' does not name a type
    MyMessage msg;

    Development

  • Is it possible to reduce SRAM usage of Arduino Nano ethernet MySensors gateway (based on ECN28J60) ?
    M matkor

    @mfalkvidd

    Use the W5100 module instead (if you need ethernet)

    Good idea, thanks! Same code, but only W5100 based:
    Sketch uses 17190 bytes (...) Global variables use 853 bytes (41%)

    Using W5500 ( Ethernet2.h ) gives even better:
    Sketch uses 14712 bytes (...) Global variables use 809 bytes (39%)

    If you don’t need ethernet, use usb or wifi since those options also use less ram.

    I need some kind of 25m wire so options are ethernet, RS-485 or PJON

    Development

  • Is it possible to reduce SRAM usage of Arduino Nano ethernet MySensors gateway (based on ECN28J60) ?
    M matkor

    I need only few binary sensors/switches (relays) controllable from HomeAssistant, so I hoped to add their simple logic to
    https://github.com/mysensors/MySensorsArduinoExamples/blob/master/examples/GatewayENC28J60/GatewayENC28J60.ino
    But building above already takes: Sketch uses 29276 bytes (...) Global variables use 1757 bytes

    I tried to reduce SRAM usage, but disabling MY_DEBUG, MY_RADIO_RF24, MY_INCLUSION_* , MY_DEFAULT_* reduces sizes to
    Sketch uses 22980 bytes (...) Global variables use 1626 bytes (79%)
    only :(

    Is there any way one can go down with SRAM usage further?

    Development

  • What is proper presentation type for binary push button? S_BINARY ? And how make controller distinguish between binary button (RO) and binary switch (RW)?
    M matkor

    Assuming I have light switch/push button with only readable state (via pin on Arduino).
    Following https://www.mysensors.org/download/serial_api_20#sensor-types ,should I present it via:

    present(CHILD_ID, S_BINARY);
    

    ?

    Later, having binary switch (which should be settable from controller) how it should be presented?

    How controller can distinguish between RO button and RW switch?

    Development binary switches presentation binary
  • Login

  • Don't have an account? Register

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