Skip to content

Commit

Permalink
0.3.1
Browse files Browse the repository at this point in the history
+ move BaySoftwareSerial to separate folder to avoid linker error with SDI-12
+ add documentation to lowCurrentBoard.h
+ remove BayTCPSIM900 and BayTCPESP8266 from RF24RouterBoard.h
  • Loading branch information
holzheu committed Sep 11, 2024
1 parent d42e363 commit bccf38d
Show file tree
Hide file tree
Showing 8 changed files with 96 additions and 39 deletions.
4 changes: 1 addition & 3 deletions libraries/BayEOS/BayEOS.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,7 @@ Note RSSI is negative but without sign as uint8_t
#define BayEOS_GetName 0x9
#define BayEOS_SetName 0xa
#define BayEOS_StartData 0xb
#define BayEOS_StopData 0xc /** Data 1 = reset buffer, 2 = reset read pointer , 3 = set read pointer to write pointer,
Still working but depreciated!!
*/
#define BayEOS_StopData 0xc /** Data 1 = reset buffer, 2 = reset read pointer , 3 = set read pointer to write pointer, DEPRECIATED!!*/
#define BayEOS_GetVersion 0xd
#define BayEOS_GetSamplingInt 0xe
#define BayEOS_SetSamplingInt 0xf
Expand Down
5 changes: 3 additions & 2 deletions libraries/BayEOS/examples/BayRF24/TestFrame/TestFrame.ino
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ void loop(void)
// Keep in mind that RF24 frames are limited to 32 byte
// Overhead is 11 byte (with checksum + delayed frames)
// When you have more than 5 channels you have to send the data in
// several frames or send data as int16
// several frames or send data as int16
// (value range -31768 ... 31767, e.g send 23.74°C as 2374)
// client.startDataFrame(BayEOS_Int16le, WITH_CHECKSUM);

#if WITH_CHECKSUM
Expand All @@ -39,5 +40,5 @@ void loop(void)
else
Serial.println("ok");

delay(2000);
delay(5000);
}
81 changes: 73 additions & 8 deletions libraries/BayEOSBoards/LowCurrentBoard.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,75 @@
/*
* This is a header file, designed to make scetches of Low Current Board easier
*
* It depends on some conventions:
* 1. bayeos.client must be named "client"
* 2. Dallas is called "ds"
* 3. Changes in CONSTANTS must be declared before include
/**
* @page LowCurrentBoard.h BayEOS Low Current Functions
*
* BayEOS Low Current Functions are designed to reduce the power consumption of
* the board to a minimum
*
* ## Actions
*
* Timer2 ISR sets the bits of the variable *action* (volatile, uint8_t).
*
* Bit 1 is action 0, bit 2 action 1...
*
* The macro ISSET_ACTION(nr) checks if the requested bit is set.<br>
* The macro UNSET_ACTION(nr) clears the bit.
*
* ACTION_COUNT defines the number of different action bits which should be set.
* Default is one. Maximum is seven.
*
* if RTC._seconds % SAMPING_INT == 0 -> set action 0<br>
* if RTC._seconds % SAMPING_INT == 1 and ACTION_COUNT>1 -> set action 1<br>
* if RTC._seconds % SAMPING_INT == 2 and ACTION_COUNT>2 -> set action 2<br>
* ...<br>
* else set_action 7
*
* Action 7 therefore has a special meaning. Normaly it is one a second (if no other action is set)
*
* ## TICKS_PER_SECOND
*
* defaults to 16. Other allowed settings are 128, 4, 2 and 1.
*
* TICKS_PER_SECONDS defines the maximum sleep time (1 second/TICKS_PER_SECOND)
* of the board.
*
* Each tick the variable *ticks* (volatile, uint16_t) is incremented.
*
* ## sleepLCB() and delayLCB()
*
* sleepLCB() sets the board to sleep mode with timer2 active. It will sleep until next tick
* occures.
*
* delayLCB() calls sleepLCB() as long as the desired sleep time is reached.
* Sleep time is always greater than desired delay, because sleepLCB() will
* last at least one full tick. The first tick is not counted as we do not now how much was
* left from the tick when the function was called.
*
* ## initLCB() and startLCB()
*
* initLCB() should be called in the setup() function. It sets pin modes
* and initializes the timer2.
*
* startLCB should be called at the end of the setup() function. The board LED
* will blink three times to indicate the user that the setup has been finished successfully.
*
* ## sendOrBufferLCB()
*
* This function tries to send the data. When this fails it writes the data to the buffer.
* In contrast to client.sendOrBuffer() sendOrBufferLCB() will give a LED feedback on the sending
* result.
*
* * Blink once: Sending successful
* * Blink two times or more: Sending failed (number of blinks is error code +1)
*
* Please note: In order to save battery power sendOrBufferLCB() only blinks
* during the first ten calls.
*
* ## RESET_COUNT
*
* Default value is zero. When RESET_COUNT is greater than zero and
* action0 is not cleared when it is set next time, the variable action0_pending_count
* (volatile, uint8_t) is incremented.
*
* When action0_pending_count is greater than RESET_COUNT the ISR resets the board.
*/

#include <Sleep.h>
Expand Down Expand Up @@ -48,7 +113,7 @@
#define UNSET_ACTION(nr) (action&= ~(1<<nr))

#ifndef ACTION_COUNT
#define ACTION_COUNT 7
#define ACTION_COUNT 1
#endif

#ifndef CHECKSUM_FRAMES
Expand Down
18 changes: 3 additions & 15 deletions libraries/BayEOSBoards/RF24RouterBoard.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,10 @@ RTC_Timer2 myRTC;
volatile long rtc_seconds_correct;
#endif

#if defined(GPRS_CONFIG)
#include <BayTCPSim900.h>
BayGPRS client(Serial, 0); // No Power Pin
#elif defined(SIM800_CONFIG)
#if defined(SIM800_CONFIG)
#include <BaySIM800.h>
#include <EEPROM.h>
BaySIM800 client = BaySIM800(Serial);
#elif defined(WLAN_CONFIG)
#include <BayTCPESP8266.h>
BayESP8266 client(Serial, WLAN_PIN);
#elif defined(SERIAL_CLIENT)
#if DEBUG_CLIENT
#include <BayDebug.h>
Expand Down Expand Up @@ -348,12 +342,8 @@ void initLCB()
client.setBuffer(myBuffer);
pinMode(POWER_PIN, OUTPUT);
digitalWrite(POWER_PIN, HIGH);
#if defined(GPRS_CONFIG)
client.readConfigFromStringPGM(PSTR(GPRS_CONFIG));
#elif defined(SIM800_CONFIG)
#if defined(SIM800_CONFIG)
client.readConfigFromStringPGM(PSTR(SIM800_CONFIG));
#elif defined(WLAN_CONFIG)
client.readConfigFromStringPGM(PSTR(WLAN_CONFIG));
#elif defined(SERIAL_CLIENT)
#if DEBUG_CLIENT
client.begin(38400, 1);
Expand Down Expand Up @@ -409,7 +399,7 @@ void initLCB()

blinkLED(3);
adjust_OSCCAL();
#if defined(GPRS_CONFIG) || defined(SIM800_CONFIG)
#if defined(SIM800_CONFIG)
delayLCB(1000);
tx_res = client.begin(38400);
#if defined(SIM800_CONFIG)
Expand All @@ -433,8 +423,6 @@ void initLCB()
if (!tx_res)
myRTC.adjust(client.now());
#endif
#elif defined(WLAN_CONFIG)
tx_res = client.begin(38400);
#elif defined(SERIAL_CLIENT)
client.sendMessage("Router started");
#else
Expand Down
20 changes: 13 additions & 7 deletions libraries/BayEOSBoards/examples/RF24Router/Router/Router.ino
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
/*
* Sketch for BayEOS-RF24-Router Board
*
* The Board can take up to three RF24-modules. Power consumption with a lipo battery is about 2Ah/d
* The Board can take up to three RF24-modules.
*
*/

#define SIM800_CONFIG "http://132.180.112.55/gateway/frame/saveFlat|import|import|GPRS-RB|pinternet.interkom.de|||1812|"
//#define GPRS_CONFIG "132.180.112.55|80|gateway/frame/saveFlat|import|import|GPRS-RB|pinternet.interkom.de|||1812|"
//#define POWER_PIN 6
//#define WLAN_CONFIG "192.168.2.108|80|gateway/frame/saveFlat|import|import|WLAN-RB|WIFISSID|secretPW|||"
//GPRS-CONFIG-String
#define SIM800_CONFIG "http://132.180.112.55/gateway/frame/saveFlat|gw-user|gw-pw|GPRS-RB|pinternet.interkom.de|||1812|"

//ESP01-Config
//#define ROUTER_NAME "ESP01Router"
//#define GATEWAY_IP "192.168.2.2"
//#define GATEWAY_USER "import"
//#define GATEWAY_PW "ChangeME"



#define SAMPLING_INT 128
#define NRF24_CHANNEL 0x2b
//Comment Channel 2 and 3 in case you did not install a module
//#define NRF24_2CHANNEL 0x4b
//#define NRF24_3CHANNEL 0x6b
#define WITH_RF24_CHECKSUM 1
const uint8_t pipe_0[] = {0x12, 0xae, 0x31, 0xc4, 0x45};
const uint8_t pipe_1[] = {0x24, 0xae, 0x31, 0xc4, 0x45};
const uint8_t pipe_0[] = {0x12, 0x79, 0x43, 0x6c, 0xf3};
const uint8_t pipe_1[] = {0x24, 0x79, 0x43, 0x6c, 0xf3};
const uint8_t pipe_2[] = {0x48};
const uint8_t pipe_3[] = {0x96};
const uint8_t pipe_4[] = {0xab};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
/*
* Sketch for BayEOS-RF24-Router Board
*
* The Board can take up to three RF24-modules. Power consumption with a lipo battery is about 2Ah/d
* The Board can take up to three RF24-modules.
*
*/

#define SAMPLING_INT 128
#define NRF24_CHANNEL 0x2b
// Comment Channel 2 and 3 in case you did not install a module
// #define NRF24_2CHANNEL 0x4b
// #define NRF24_3CHANNEL 0x6b
#define WITH_RF24_CHECKSUM 1
const uint8_t pipe_0[] = {0x12, 0xae, 0x31, 0xc4, 0x45};
const uint8_t pipe_1[] = {0x24, 0xae, 0x31, 0xc4, 0x45};
const uint8_t pipe_0[] = {0x12, 0x79, 0x43, 0x6c, 0xf3};
const uint8_t pipe_1[] = {0x24, 0x79, 0x43, 0x6c, 0xf3};
const uint8_t pipe_2[] = {0x48};
const uint8_t pipe_3[] = {0x96};
const uint8_t pipe_4[] = {0xab};
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit bccf38d

Please sign in to comment.