A kitchen-sink options header


  • Plugin Developer

    I'm creating a number of sketches for MySensors, and since I will be publishing them I want them all to have a nice, solid header that contains interesting settings.

    This is what I got so far:

    
    //
    // SETTINGS
    // Add or remove the two slashes at the beginning a line to enable or disable it.
    //
    
    // MySensors: enable and select the attached radio type
    #define MY_RADIO_NRF24                              // This is a common and simple radio used with MySensors. Downside is that it uses the same frequency space as WiFi.
    //#define MY_RADIO_NRF5_ESB                         // This is a new type of device that is arduino and radio all in one. Currently not suitable for beginners yet.
    //#define MY_RADIO_RFM69                            // This is an open source radio on the 433mhz frequency. Great range and built-in encryption, but more expensive and little more difficult to connect.
    //#define MY_RADIO_RFM95                            // This is a LoRaWan radio, which can have a range of 10km.
    
    // MySensors: choose your desired radio power level. Only choose one.
    //#define MY_RF24_PA_LEVEL RF24_PA_MIN              // Low power also means low range.
    #define MY_RF24_PA_LEVEL RF24_PA_LOW                // This is a good middle of the road setting.
    //#define MY_RF24_PA_LEVEL RF24_PA_HIGH             // High power can cause issues on cheap Chinese NRF24 radios
    //#define MY_RF24_PA_LEVEL RF24_PA_MAX              // Offers the most range, but high power can cause issues on cheap Chinese NRF24 radios
    
    // Mysensors: security
    //#define MY_SECURITY_SIMPLE_PASSWD "changeme"      // Be aware that longer passwords use slightly more memory.
    //#define MY_SIGNING_SOFT_RANDOMSEED_PIN A7         // Setting a pin to pickup random electromagnetic noise helps make encryption more secure.
    
    // Mysensors: advanced settings
    #define MY_TRANSPORT_WAIT_READY_MS 10000            // Try connecting for 10 seconds. Otherwise just continue.
    //#define MY_RF24_CHANNEL 100                       // In EU the default channel 76 overlaps with wifi, so you could try using channel 100. You will have to select the same setting on every device in the network (including the gateway).
    //#define MY_RF24_DATARATE RF24_250KBPS             // Slower datarate, increases wireless range. Does not work on all hardware.
    //#define MY_RF24_DATARATE RF24_1MBPS               // Medium, safe setting.
    //#define MY_RF24_DATARATE RF24_2MBPS               // Fastest datarate, at the cost of less range. Does not work on all hardware.
    
    //#define MY_NODE_ID 10                             // Giving a node a manual ID can in rare cases fix connection issues.
    //#define MY_PARENT_NODE_ID 0                       // Fixating the ID of the gateway node can in rare cases fix connection issues.
    //#define MY_PARENT_NODE_IS_STATIC                  // Used together with setting the parent node ID. Daking the controller ID static can in rare cases fix connection issues.
    #define MY_SPLASH_SCREEN_DISABLED                   // Saves a little memory.
    //#define MY_DISABLE_RAM_ROUTING_TABLE_FEATURE      // Saves a little memory. On simple Arduino's this is already disabled by default.
    #define MY_DISABLE_SIGNAL_REPORT                    // Saves 1kb of space
    
    // MySensors: enable debug output to the serial monitor?
    //#define MY_DEBUG                                  // This can help check if the radio is working ok.
    
    // MySensors: do you want this node to also be a repeater? 
    #define MY_REPEATER_FEATURE                         // The devices can form a mesh network by passing along messages for each other. The only reason to disable this is if the device runs on battery power.
    
    
    

    Are there interesting settings that I am missing?


  • Mod

    @alowhum note sure which are interesting, but this should be the full list:

    MY_BAUD_RATE
    MY_CORE_ONLY
    MY_CORE_MIN_VERSION
    MY_CORE_VERSION
    MY_CRITICAL_SECTION
    MY_DISABLE_RAM_ROUTING_TABLE_FEATURE
    MY_DISABLE_REMOTE_RESET
    MY_DISABLED_SERIAL
    MY_INDICATION_HANDLER
    MY_RX_MESSAGE_BUFFER_SIZE
    MY_RX_MESSAGE_BUFFER_FEATURE
    MY_SERIAL_OUTPUT_SIZE
    MY_SLEEP_NOT_POSSIBLE
    MY_SMART_SLEEP_WAIT_DURATION
    MY_SPLASH_SCREEN_DISABLED
    MY_WAKE_UP_BY_TIMER
    MY_CORE_COMPATIBILITY_CHECK
    MY_DEBUG_VERBOSE_TRANSPORT
    MY_NODE_ID
    MY_PARENT_NODE_ID
    MY_PARENT_NODE_IS_STATIC
    MY_PASSIVE_NODE
    MY_RAM_ROUTING_TABLE_FEATURE
    MY_REGISTRATION_CONTROLLER
    MY_REGISTRATION_DEFAULT
    MY_REGISTRATION_FEATURE
    MY_REGISTRATION_RETRIES
    MY_REPEATER_FEATURE
    MY_ROUTING_TABLE_SAVE_INTERVAL_MS
    MY_SIGNAL_REPORT_ENABLED
    MY_SLEEP_TRANSPORT_RECONNECT_TIMEOUT_MS
    MY_SMART_SLEEP_WAIT_DURATION_MS
    MY_TRANSPORT_CHKUPL_INTERVAL_MS
    MY_TRANSPORT_DISCOVERY_INTERVAL_MS
    MY_TRANSPORT_MAX_TSM_FAILURES
    MY_TRANSPORT_MAX_TX_FAILURES
    MY_TRANSPORT_SANITY_CHECK
    MY_TRANSPORT_SANITY_CHECK_INTERVAL
    MY_TRANSPORT_SANITY_CHECK_INTERVAL_MS
    MY_TRANSPORT_STATE_RETRIES
    MY_TRANSPORT_STATE_TIMEOUT_MS
    MY_TRANSPORT_TIMEOUT_EXT_FAILURE_STATE_MS
    MY_TRANSPORT_TIMEOUT_FAILURE_STATE_MS
    MY_TRANSPORT_UPLINK_CHECK_DISABLED
    MY_TRANSPORT_WAIT_READY_MS
    MY_DEBUG
    MY_DEBUGDEVICE
    MY_DEBUG_VERBOSE_GATEWAY
    MY_SPECIAL_DEBUG
    MY_DEBUG_OTA
    MY_DEBUG_OTA_DISABLE_ACK
    MY_DEBUG_VERBOSE_OTA_UPDATE
    MY_DEFAULT_ERR_LED_PIN
    MY_DEFAULT_LED_BLINK_PERIOD
    MY_DEFAULT_RX_LED_PIN
    MY_DEFAULT_TX_LED_PIN
    MY_INCLUSION_MODE_FEATURE
    MY_INCLUSION_BUTTON_FEATURE
    MY_INCLUSION_MODE_BUTTON_PIN
    MY_INCLUSION_MODE_DURATION
    MY_INCLUSION_LED_PIN
    MY_OTA_FIRMWARE_FEATURE
    MY_OTA_FLASH_SS
    MY_OTA_FLASH_JDECID
    MY_OTA_LOG_RECEIVER_FEATURE
    MY_OTA_LOG_SENDER_FEATURE
    MY_OTA_USE_I2C_EEPROM
    MY_SPIFLASH_SST25TYPE
    MY_WITH_LEDS_BLINKING_INVERSE
    MY_DEBUG_VERBOSE_SIGNING
    MY_ENCRYPTION_SIMPLE_PASSWD
    MY_NODE_LOCK_FEATURE
    MY_NODE_UNLOCK_PIN
    MY_NODE_LOCK_COUNTER_MAX
    MY_SECURITY_SIMPLE_PASSWD
    MY_SIGNING_ATSHA204
    MY_SIGNING_ATSHA204_PIN
    MY_SIGNING_NODE_WHITELISTING
    MY_SIGNING_SIMPLE_PASSWD
    MY_SIGNING_SOFT
    MY_SIGNING_SOFT_RANDOMSEED_PIN
    MY_SIGNING_REQUEST_SIGNATURES
    MY_SIGNING_WEAK_SECURITY
    MY_VERIFICATION_TIMEOUT_MS
    MY_HW_HAS_GETENTROPY
    MY_GATEWAY_TINYGSM
    MY_GSM_APN
    MY_GSM_BAUDRATE
    MY_GSM_PIN
    MY_GSM_PSW
    MY_GSM_RX
    MY_GSM_SSID
    MY_GSM_TX
    MY_GSM_USR
    MY_SOFTSPI
    MY_SOFT_SPI_MISO_PIN
    MY_SOFT_SPI_MOSI_PIN
    MY_SOFT_SPI_SCK_PIN
    MY_DEBUG_VERBOSE_RF24
    MY_RADIO_RF24
    MY_RF24_ADDR_WIDTH
    MY_RF24_BASE_RADIO_ID
    MY_RF24_ENABLE_ENCRYPTION
    MY_RF24_CE_PIN
    MY_RF24_CHANNEL
    MY_RF24_CS_PIN
    MY_RF24_DATARATE
    MY_RF24_IRQ_PIN
    MY_RF24_PA_LEVEL
    MY_RF24_POWER_PIN
    MY_RF24_SPI_SPEED
    MY_DEBUG_VERBOSE_NRF5_ESB
    MY_NRF5_ESB_ADDR_WIDTH
    MY_NRF5_ESB_BASE_RADIO_ID
    MY_NRF5_ESB_CHANNEL
    MY_NRF5_ESB_ENABLE_ENCRYPTION
    MY_NRF5_ESB_MODE
    MY_NRF5_ESB_PA_LEVEL
    MY_NRF5_ESB_RX_BUFFER_SIZE
    MY_NRF5_ESB_REVERSE_ACK_RX
    MY_NRF5_ESB_REVERSE_ACK_TX
    MY_RADIO_NRF5_ESB
    MY_DEBUG_VERBOSE_RFM95
    MY_RADIO_RFM95
    MY_RFM95_ATC_MODE_DISABLED
    MY_RFM95_ATC_TARGET_RSSI
    MY_RFM95_ATC_TARGET_RSSI_DBM
    MY_RFM95_CS_PIN
    MY_RFM95_FREQUENCY
    MY_RFM95_IRQ_NUM
    MY_RFM95_IRQ_PIN
    MY_RFM95_MAX_POWER_LEVEL_DBM
    MY_RFM95_MODEM_CONFIGRUATION
    MY_RFM95_POWER_PIN
    MY_RFM95_RST_PIN
    MY_RFM95_SPI_SPEED
    MY_RFM95_TCXO
    MY_RFM95_TX_POWER
    MY_RFM95_TX_POWER_DBM
    MY_RFM95_TX_TIMEOUT_MS
    MY_RFM95_ENABLE_ENCRYPTION
    MY_DEBUG_VERBOSE_RFM69
    MY_DEBUG_VERBOSE_RFM69_REGISTERS
    MY_IS_RFM69HW
    MY_RADIO_RFM69
    MY_RFM69_ATC_MODE_DISABLED
    MY_RFM69_ATC_TARGET_RSSI_DBM
    MY_RFM69_BITRATE_LSB
    MY_RFM69_BITRATE_MSB
    MY_RFM69_CS_PIN
    MY_RFM69_CSMA_ADD_DELAY_BASE
    MY_RFM69_CSMA_ADD_DELAY_COUNT
    MY_RFM69_CSMA_LIMIT_DBM
    MY_RFM69_CSMA_TIMEOUT_MS
    MY_RFM69_DEFAULT_LISTEN_IDLE_US
    MY_RFM69_DEFAULT_LISTEN_RX_US
    MY_RFM69_ENABLE_ENCRYPTION
    MY_RFM69_ENABLE_LISTENMODE
    MY_RFM69_FREQUENCY
    MY_RFM69_IRQ_NUM
    MY_RFM69_IRQ_PIN
    MY_RFM69_MAX_POWER_LEVEL_DBM
    MY_RFM69_MODEM_CONFIGURATION
    MY_RFM69_NETWORKID
    MY_RFM69_NEW_DRIVER
    MY_RFM69_POWER_PIN
    MY_RFM69_RST_PIN
    MY_RFM69_SPI_SPEED
    MY_RFM69_TX_TIMEOUT_MS
    MY_RFM69_TX_POWER_DBM
    MY_RS485
    MY_RS485_BAUD_RATE
    MY_RS485_DE_PIN
    MY_RS485_HWSERIAL
    MY_RS485_MAX_MESSAGE_LENGTH
    MY_RS485_SOH_COUNT
    MY_GATEWAY_CLIENT_MODE
    MY_GATEWAY_ENC28J60
    MY_GATEWAY_ESP32
    MY_GATEWAY_ESP8266
    MY_GATEWAY_MQTT_CLIENT
    MY_GATEWAY_SERIAL
    MY_GATEWAY_W5100
    MY_HOSTNAME
    MY_INCLUSION_BUTTON_EXTERNAL_PULLUP
    MY_MQTT_CLIENT_ID
    MY_MQTT_CLIENT_PUBLISH_RETAIN
    MY_MQTT_PASSWORD
    MY_MQTT_PUBLISH_TOPIC_PREFIX
    MY_MQTT_SUBSCRIBE_TOPIC_PREFIX
    MY_MQTT_USER
    MY_W5100_SPI_EN
    MY_WIFI_SSID
    MY_WIFI_BSSID
    MY_WIFI_PASSWORD
    MY_CONTROLLER_IP_ADDRESS
    MY_CONTROLLER_URL_ADDRESS
    MY_GATEWAY_MAX_CLIENTS
    MY_GATEWAY_MAX_RECEIVE_LENGTH
    MY_GATEWAY_MAX_SEND_LENGTH
    MY_IP_ADDRESS
    MY_IP_GATEWAY_ADDRESS
    MY_IP_RENEWAL_INTERVAL
    MY_IP_RENEWAL_INTERVAL_MS
    MY_IP_SUBNET_ADDRESS
    MY_MAC_ADDRESS
    MY_PORT
    MY_USE_UDP
    MY_ESP8266_SERIAL_MODE
    

  • Plugin Developer

    Thanks for that.

    I'm curious though: are there any on that list that you often/sometimes use in sketches that I didn't list?


  • Mod

    @alowhum no, but I don't use 90% of what's already on your list either 😉


  • Plugin Developer

    Learning a little more today:

    Apparently..

    #define MY_DISABLE_RAM_ROUTING_TABLE_FEATURE
    

    ..is not required for Arduino Nano boards. Because they have little RAM, MySensors disables it automatically. Nice!

    I also want my nodes to always keep trying to reconnect to the network. I thought that would be standard, but apparently it's not? Is my understanding correct? The code below would set it to try and reconnect later:

    #define MY_TRANSPORT_WAIT_READY_MS (10*1000ul) // On boot-up, stop trying to connect to the gateway after 10 seconds
    #define MY_TRANSPORT_TIMEOUT_EXT_FAILURE_STATE (15*60*1000ul) // If connection is down, try to reconnect to the gateway every 15 minutes.
    

    In the documentation I also noticed "MY_TRANSPORT_TIMEOUT_FAILURE_STATE_MS" which is set to ten seconds. I guess this happens:

    • If the radio is OK, every 10 seconds, for a maximum of 7 times, the node will try to connect to the gateway.
    • If it fails after 7 retries, it will wait much longer before retrying?

    Does it eventually give up?



  • get rid of all your apostrophes. Those words are pluralized, not possessive (as long as you're trying to clean it up and make it look nice you might as well fix the punctuation).


  • Plugin Developer

    @waspie: done 🙂

    Doe anyone have any idea about the retries? I'd like my nodes to keep trying to reconnect as long as they have power.

    Another question:

    I've read different things about

    #define MY_DISABLE_SIGNAL_REPORT
    

    Some recently said this saves memory, but I've found an older post that states it's already disabled by default.


Log in to reply
 

Suggested Topics

  • 1
  • 6
  • 1
  • 2
  • 5
  • 2

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts