Some people have reported problem when first radio transmit after sleep was send.

Added radio powerUp() in "sleeping" example sketches.
This commit is contained in:
Henrik Ekblad
2014-02-09 20:54:33 +01:00
parent 94f800c18b
commit 2ade6ac2d8
9 changed files with 15 additions and 2 deletions
@@ -46,6 +46,7 @@ void setup()
void loop()
{
gw.powerUp();
sensors.requestTemperatures(); // Fetch temperatures from Dallas
delay(100);
for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
@@ -35,6 +35,7 @@ void setup()
void loop()
{
gw.powerUp(); // Power up radio
int dist = metric?sonar.ping_cm():sonar.ping_in();
Serial.print("Ping: ");
@@ -60,9 +60,11 @@ void setup()
void loop()
{
unsigned long now = millis();
unsigned long now = millis();
// Only send values at a maximum frequency or woken up from sleep
if (SLEEP_MODE || now - lastSend > 1000*SEND_FREQUENCY) {
gw.powerUp(); // Power up radio
// New watt value has been calculated
if (!SLEEP_MODE && watt != oldWatt) {
// Check that we dont get unresonable large watt value.
@@ -36,7 +36,8 @@ void setup()
}
void loop()
{
{
gw.powerUp(); // Power up radio
delay(dht.getMinimumSamplingPeriod());
float temperature = dht.getTemperature();
@@ -28,6 +28,8 @@ void setup()
void loop()
{
gw.powerUp(); // Power up radio
int lightLevel = (1023-analogRead(LIGHT_SENSOR_ANALOG_PIN))/10.23;
Serial.println(lightLevel);
if (lightLevel != lastLightLevel) {
@@ -28,6 +28,7 @@ void setup()
void loop()
{
gw.powerUp(); // Power up radio
// Read digital motion value
boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH;
@@ -47,6 +47,8 @@ void setup() {
void loop() {
gw.powerUp(); // Power up radio
float pressure = bmp.readPressure();
float temperature = bmp.readTemperature();
@@ -30,6 +30,7 @@ int lastSoilValue = -1;
void loop()
{
gw.powerUp(); // Power up radio
// Read digital soil value
int soilValue = digitalRead(DIGITAL_INPUT_SOIL_SENSOR); // 1 = Not triggered, 0 = In soil with water
if (soilValue != lastSoilValue) {
@@ -79,6 +79,8 @@ void loop()
// Only send values at a maximum frequency or woken up from sleep
if (SLEEP_MODE || currentTime - lastSend > 1000*SEND_FREQUENCY) {
gw.powerUp(); // Power up radio
// New flow value has been calculated
if (!SLEEP_MODE && flow != oldflow) {
// Check that we dont get unresonable large flow value.