Skip to content

Commit

Permalink
Polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
tekka007 committed Mar 28, 2017
1 parent f649996 commit ee253ff
Show file tree
Hide file tree
Showing 14 changed files with 252 additions and 377 deletions.
40 changes: 26 additions & 14 deletions MyConfig.h
Expand Up @@ -82,9 +82,10 @@
#define MY_SERIAL_OUTPUT_SIZE (120u)
#endif



// Disables over-the-air reset of node
/**
* @def MY_DISABLE_REMOTE_RESET
* @brief Disables over-the-air reset of node
*/
//#define MY_DISABLE_REMOTE_RESET

/**********************************
Expand Down Expand Up @@ -672,7 +673,7 @@

/**
* @def MY_RFM69_FREQUENCY
* @brief RFM69 frequency to use (RFM69_433MHZ for 433MHz, RFM69_868MHZ for 868MHz or RFM69_915MHZ for 915MHz).
* @brief RFM69 frequency to use: RFM69_433MHZ, RFM69_868MHZ, RFM69_915MHZ, or custom frequency in Hz (new RFM69 driver only).
*
* This must match the hardware version of the RFM69 radio.
*/
Expand Down Expand Up @@ -718,6 +719,13 @@
*/
//#define MY_RFM69_ATC_MODE_DISABLED

/**
* @def RFM69_MAX_POWER_LEVEL_DBM
* @brief Set max TX power in dBm if local legislation requires
* 1mW = 0dBm, 10mW = 10dBm, 25mW = 14dBm, 100mW = 20dBm
*/
//#define RFM69_MAX_POWER_LEVEL_DBM (10u)

/**
* @def MY_RFM69_NETWORKID
* @brief RFM69 Network ID. Use the same for all nodes that will talk to each other.
Expand All @@ -732,12 +740,10 @@
*/
//#define MY_RFM69_RST_PIN (9)

#ifndef MY_RFM69_RST_PIN
// legacy
// legacy, older board files
#ifdef MY_RF69_RESET
#define MY_RFM69_RST_PIN MY_RF69_RESET
#endif
#endif

/**
* @def MY_RFM69_POWER_PIN
Expand Down Expand Up @@ -802,9 +808,7 @@
//#define MY_RFM69_ENABLE_ENCRYPTION

/**
* @def MY_RFM69_ENABLE_LISTENMODE
* Enables RFM69 listen mode
* @brief Uncomment if you need listenmode. else comment it and save memory
* Uncomment if you need listenmode. else comment it and save memory
*/
//#define MY_RFM69_ENABLE_LISTENMODE

Expand Down Expand Up @@ -845,12 +849,12 @@

/**
* @def MY_RFM95_FREQUENCY
* @brief RFM95 frequency
* @brief RFM95 frequency to use: RFM95_169MHZ, RFM95_315MHZ, RFM95_434MHZ, RFM95_868MHZ, RFM95_915MHZ, or custom frequency in Hz.
*
* This must match the hardware version of the RFM95 radio.
*/
#ifndef MY_RFM95_FREQUENCY
#define MY_RFM95_FREQUENCY (868.1f)
#define MY_RFM95_FREQUENCY RFM95_868MHZ
#endif

/**
Expand Down Expand Up @@ -922,7 +926,7 @@
* @brief RFM95 TX power level.
*/
#ifndef MY_RFM95_TX_POWER_DBM
#define MY_RFM95_TX_POWER_DBM (13u)
#define MY_RFM95_TX_POWER_DBM (13u) // 20mW
#endif

/**
Expand All @@ -939,6 +943,13 @@
#define MY_RFM95_ATC_TARGET_RSSI (-60)
#endif

/**
* @def RFM95_MAX_POWER_LEVEL_DBM
* @brief Set max TX power in dBm if local legislation requires
* 1mW = 0dBm, 10mW = 10dBm, 25mW = 14dBm, 100mW = 20dBm
*/
//#define RFM95_MAX_POWER_LEVEL_DBM (10u)

/**
* @def MY_RFM95_TCXO
* @brief Enable to force your radio to use an external frequency source (e.g. TCXO, if present).
Expand Down Expand Up @@ -1146,6 +1157,7 @@
#define MY_MQTT_CLIENT_PUBLISH_RETAIN
// general
#define MY_INDICATION_HANDLER
#define MY_DISABLE_REMOTE_RESET
// signing
#define MY_SIGNING_ATSHA204
#define MY_SIGNING_SOFT
Expand All @@ -1165,9 +1177,9 @@
#define MY_IS_RFM69HW
#define MY_RFM69_NEW_DRIVER
#define MY_RFM69_POWER_PIN
#define MY_RFM69_ENABLE_LISTENMODE
#define MY_RFM69_ENABLE_ENCRYPTION
#define MY_RFM69_ATC_MODE_DISABLED
#define RFM69_MAX_POWER_LEVEL_DBM
#define MY_RFM69_RST_PIN
#define MY_DEBUG_VERBOSE_RFM69
#define MY_DEBUG_VERBOSE_RFM69_REGISTERS
Expand Down
6 changes: 6 additions & 0 deletions core/MyCapabilities.h
Expand Up @@ -37,7 +37,13 @@
#if defined(MY_RADIO_NRF24)
#define MY_CAP_RADIO "N"
#elif defined(MY_RADIO_RFM69)
#if !defined(MY_RFM69_NEW_DRIVER)
// old RFM69 driver
#define MY_CAP_RADIO "R"
#else
// new RFM69 driver
#define MY_CAP_RADIO "P"
#endif
#elif defined(MY_RADIO_RFM95)
#define MY_CAP_RADIO "L"
#elif defined(MY_RS485)
Expand Down
2 changes: 1 addition & 1 deletion core/MyHwSTM32F1.cpp
Expand Up @@ -34,7 +34,7 @@
* CE NA
* IRQ PA3 (default)
*
* Wiring RFM69 radio / SPI1
* Wiring RF24 radio / SPI1
* --------------------------------------------------
* CLK PA5
* MISO PA6
Expand Down
2 changes: 1 addition & 1 deletion core/MyTransport.h
Expand Up @@ -263,7 +263,7 @@ typedef int16_t transportRSSI_t; //!< Datatype for internal RSSI storage
*/
typedef struct {
// SM variables
transportState_t* currentState; //!< pointer to current fsm state
transportState_t* currentState; //!< pointer to current FSM state
uint32_t stateEnter; //!< state enter timepoint
// general transport variables
uint32_t lastUplinkCheck; //!< last uplink check, required to prevent GW flooding
Expand Down
2 changes: 2 additions & 0 deletions drivers/RF24/RF24.cpp
Expand Up @@ -446,6 +446,8 @@ LOCAL void RF24_registerReceiveCallback(RF24_receiveCallbackType cb)

LOCAL bool RF24_initialize(void)
{
RF24_DEBUG(PSTR("RF24:INIT\n"));
RF24_DEBUG(PSTR("RF24:INIT:PIN,CE=%d,CS=%d\n"), MY_RF24_CE_PIN, MY_RF24_CS_PIN);
// Initialize pins & HW
#if defined(MY_RF24_POWER_PIN)
hwPinMode(MY_RF24_POWER_PIN, OUTPUT);
Expand Down
3 changes: 2 additions & 1 deletion drivers/RF24/RF24.h
Expand Up @@ -37,6 +37,7 @@
* |E| SYS | SUB | Message | Comment
* |-|-------|-------|-----------------------------------|---------------------------------------------------------------------
* | | RF24 | INIT | | Initialise RF24 radio
* | | RF24 | INIT | PIN,CE=%d,CS=%d | Pin configuration: chip enable (CE), chip select (CS)
* |!| RF24 | INIT | SANCHK FAIL | Sanity check failed, check wiring or replace module
* | | RF24 | SPP | PCT=%d,TX LEVEL=%d | Set TX level, input TX percent (PCT)
* | | RF24 | RBR | REG=%d,VAL=%d | Read register (REG), value=(VAL)
Expand Down Expand Up @@ -73,7 +74,7 @@
#define DEFAULT_RF24_CE_PIN (22) //!< DEFAULT_RF24_CE_PIN
//#define DEFAULT_RF24_CS_PIN (24) //!< DEFAULT_RF24_CS_PIN
#elif defined(ARDUINO_ARCH_STM32F1)
#define DEFAULT_RF24_CE_PIN (22) //!< DEFAULT_RF24_CE_PIN
#define DEFAULT_RF24_CE_PIN (PB0) //!< DEFAULT_RF24_CE_PIN
#else
#define DEFAULT_RF24_CE_PIN (9) //!< DEFAULT_RF24_CE_PIN
#endif
Expand Down

0 comments on commit ee253ff

Please sign in to comment.