error: 'class Child' has no member named 'setPulseFactor'; did you mean 'setPresentation'?



  • Hello MySensors friends,

    I'm trying to get my raingauge working with nodemanager but I am stuck on setting the pulsefactor and other settingsgiving me errors I can't resolve by myself.
    I am using the easypcb from @sundberg84 (rfm69 version) with mysensor version 2.3.0

    I allready figured out how to use these settings for my temperature and hunidity sensors.
    like htu21.children.get(1)->setValueDelta(0.5); //temp

    But using the same approach for my rainsensors does not work.
    rainGauge.children.get(1)->setPulseFactor(0.36); //pulsefactor

    Can anyone explain why this does not work for the raingauge?

    Thanks in advance!

    My code:

    /*
    * The MySensors Arduino library handles the wireless radio link and protocol
    * between your home built sensors/actuators and HA controller of choice.
    * The sensors forms a self healing radio network with optional repeaters. Each
    * repeater and gateway builds a routing tables in EEPROM which keeps track of the
    * network topology allowing messages to be routed to nodes.
    *
    * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
    * Copyright (C) 2013-2017 Sensnology AB
    * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
    *
    * Documentation: http://www.mysensors.org
    * Support Forum: http://forum.mysensors.org
    *
    * This program is free software; you can redistribute it and/or
    * modify it under the terms of the GNU General Public License
    * version 2 as published by the Free Software Foundation.
    */
    
    /**************************
    Template
    
    This sketch can be used as a template since containing the most relevant MySensors library configuration settings, 
    NodeManager's settings, all its the supported sensors commented out and a sketch structure fully functional to operate with
    NodeManager. Just uncomment the settings you need and the sensors you want to add and configure the sensors in before()
    */
    
    /**********************************
     * MySensors node configuration
     */
    
    // General settings
    #define SKETCH_NAME "Rain Gauge"                // Change to a fancy name you like
    #define SKETCH_VERSION "1.2"                    // Your version
    #define MY_DEBUG
    #define MY_NODE_ID 4
    
    // RFM69 radio settings
    #define MY_RADIO_RFM69
    #define MY_IS_RFM69HW
    #define MY_RFM69_NEW_DRIVER
    
    
    // Advanced settings
    #define MY_BAUD_RATE 9600
    //#define MY_SMART_SLEEP_WAIT_DURATION_MS 500
    #define MY_SPLASH_SCREEN_DISABLED
    //#define MY_DISABLE_RAM_ROUTING_TABLE_FEATURE
    //#define MY_SIGNAL_REPORT_ENABLED
    
    /***********************************
     * NodeManager configuration
     */
    
    #define NODEMANAGER_DEBUG ON
    #define NODEMANAGER_INTERRUPTS ON
    #define NODEMANAGER_SLEEP ON
    #define NODEMANAGER_RECEIVE ON
    #define NODEMANAGER_DEBUG_VERBOSE OFF
    #define NODEMANAGER_POWER_MANAGER OFF
    #define NODEMANAGER_CONDITIONAL_REPORT OFF
    #define NODEMANAGER_EEPROM OFF
    #define NODEMANAGER_TIME OFF
    #define NODEMANAGER_RTC OFF
    #define NODEMANAGER_SD OFF
    #define NODEMANAGER_HOOKING OFF
    #define NODEMANAGER_OTA_CONFIGURATION OFF
    #define NODEMANAGER_SERIAL_INPUT OFF
    
    // import NodeManager library (a nodeManager object will be then made available)
    #include <MySensors_NodeManager.h>
    
    /***********************************
     * Add your sensors
     */
    
    //PowerManager power(5,6);
     
    #include <sensors/SensorBattery.h>
    SensorBattery battery;
    
    #include <sensors/SensorRainGauge.h>
    SensorRainGauge rainGauge(3);
    
    
    /***********************************
     * Main Sketch
     */
    
    // before
    void before() {
    	
      /***********************************
       * Configure your sensors
       */
       
      // EXAMPLES:
      // report measures of every attached sensors every 10 seconds
      //nodeManager.setReportIntervalSeconds(10);
     
      // report measures of every attached sensors every 60 minutes
      nodeManager.setReportIntervalMinutes(60);
      
      // set the node to sleep in 60 minutes cycles
      nodeManager.setSleepMinutes(60);
     
      // report battery level every 60 minutes
      battery.setReportIntervalMinutes(60);
    
     
     //Raingauge
     rainGauge.children.get(1)->setPulseFactor(0.36); //pulsefactor
    
     // [19] if enabled, when waking up from the interrupt, the board stops sleeping. Disable it when attaching e.g.
     rainGauge.children.get()->setSleepInterruptPin(3); //Sleep interupt pin
     // [28] ignore two consecutive interrupts if happening within this timeframe in milliseconds (default: 100)
     rainGauge.children.get()->setInterruptDebounce(500); //debounce
     
     
      // call NodeManager before routine
      nodeManager.before();
    }
    
    // presentation
    void presentation() {
      // call NodeManager presentation routine
      nodeManager.presentation();
    }
    
    // setup
    void setup() {
      // call NodeManager setup routine
      nodeManager.setup();
    }
    
    // loop
    void loop() {
      // call NodeManager loop routine
      nodeManager.loop();
    }
    
    #if NODEMANAGER_RECEIVE == ON
    // receive
    void receive(const MyMessage &message) {
      // call NodeManager receive routine
      nodeManager.receive(message);
    }
    #endif
    
    #if NODEMANAGER_TIME == ON
    // receiveTime
    void receiveTime(unsigned long ts) {
      // call NodeManager receiveTime routine
      nodeManager.receiveTime(ts);
    }
    #endif
    


  • Hi @edweather, I have no experience with NodeManager, but I had a quick look at the source code.

    setValueDelta is a member of the Child class, which manages all the kinds of data common to all sensors, like their IDs, getting and setting sensor values and their precision, thresholds, etc. This is why you specify it for every children separately, if you're not happy with the default value.

    setPulseFactor on the other hand is a public member of SensorPulseMeter which SensorRainGauge inherits from. It is not specific to any child of the sensor. You are meant to call it directly on the sensor's class instance, like so: rainGauge.setPulseFactor(0.36);

    For the same reason I think you also want to change

      rainGauge.children.get()->setSleepInterruptPin(3); //Sleep interupt pin
      rainGauge.children.get()->setInterruptDebounce(500); //debounce
    

    to

      nodeManager.setSleepInterruptPin(3);
      nodeManager.setInterruptDebounce(500);
    

    because both are public members of the NodeManager class.

    I think that should work for you. If I'm totally wrong, just ignore what I wrote. 😄



  • @BearWithBeard said in error: 'class Child' has no member named 'setPulseFactor'; did you mean 'setPresentation'?:

    rainGauge.setPulseFactor(0.36);

    Up and running!
    Thanks a lot @BearWithBeard for the clear explanation. Now I understand why it did not work!.

    0b1d0654-02d3-4b42-a99a-e74065bb39ed-image.png


Log in to reply
 

Suggested Topics

  • 2
  • 1
  • 16
  • 2
  • 2
  • 2

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts