new version 20200522

This commit is contained in:
Joerg Lehmann 2020-05-22 11:14:51 +02:00
parent bf8c9f8441
commit 760ae035fd
3 changed files with 13 additions and 14 deletions

View File

@ -503,7 +503,7 @@ uint8_t GetVBatValue(int millivolts)
void DoDeepSleep(uint32_t sleep_time) void DoDeepSleep(uint32_t sleep_time)
{ {
if (config_data.debug_level > 0) { if (config_data.debug_level > 0) {
gCatena.SafePrintf("%010d - now going to deep sleep\n", millis()); gCatena.SafePrintf("%010d - DoDeepSleep, now going to deep sleep\n", millis());
} }
// Prepare Deep Sleep // Prepare Deep Sleep
@ -511,21 +511,14 @@ void DoDeepSleep(uint32_t sleep_time)
gLed.Set(LedPattern::Off); gLed.Set(LedPattern::Off);
} }
Serial.end(); deepSleepPrepare();
Wire.end();
SPI.end();
if (fFlash)
gSPI2.end();
// Now sleeping... // Now sleeping...
gCatena.Sleep(sleep_time); gCatena.Sleep(sleep_time);
// Recover from wakeup... // Recover from wakeup...
Serial.begin(); deepSleepRecovery();
Wire.begin();
SPI.begin();
if (fFlash)
gSPI2.begin();
if (config_data.debug_level > 0) { if (config_data.debug_level > 0) {
gCatena.SafePrintf("%010d - done with deep sleep\n", millis()); gCatena.SafePrintf("%010d - done with deep sleep\n", millis());
} }
@ -1010,6 +1003,10 @@ void doDeepSleep(osjob_t *pJob)
fDeepSleepTest ? CATCFG_T_CYCLE_TEST : gTxCycle fDeepSleepTest ? CATCFG_T_CYCLE_TEST : gTxCycle
); );
if (config_data.debug_level > 0) {
gCatena.SafePrintf("%010d - doDeepSleep, sleepInterval: %d...\n", millis(), sleepInterval);
}
/* ok... now it's time for a deep sleep */ /* ok... now it's time for a deep sleep */
gLed.Set(LedPattern::Off); gLed.Set(LedPattern::Off);
deepSleepPrepare(); deepSleepPrepare();
@ -1049,6 +1046,7 @@ void doLightSleep(osjob_t *pJob)
if (config_data.debug_level > 1) { if (config_data.debug_level > 1) {
gLed.Set(LedPattern::Sleeping); gLed.Set(LedPattern::Sleeping);
gCatena.SafePrintf("%010d - doLightSleep\n", millis());
} }
if (gCatena.GetOperatingFlags() & if (gCatena.GetOperatingFlags() &
@ -1062,6 +1060,7 @@ void doLightSleep(osjob_t *pJob)
os_getTime() + interval, os_getTime() + interval,
sleepDoneCb sleepDoneCb
); );
} }
static void sleepDoneCb(osjob_t* pJob) static void sleepDoneCb(osjob_t* pJob)

View File

@ -56,7 +56,7 @@ enum {
| |
\****************************************************************************/ \****************************************************************************/
static const int32_t fwVersion = 20200514; static const int32_t fwVersion = 20200522;
static const byte INIT_PACKAGE_INTERVAL = 100; // send an init package every 100 packages; static const byte INIT_PACKAGE_INTERVAL = 100; // send an init package every 100 packages;
static const byte MAX_VALUES_TO_SEND = 8; static const byte MAX_VALUES_TO_SEND = 8;

View File

@ -6,8 +6,8 @@
#include "SparkFun_Qwiic_Scale_NAU7802_Arduino_Library.h" #include "SparkFun_Qwiic_Scale_NAU7802_Arduino_Library.h"
#define SAMPLES 10 #define SAMPLES 5
#define IGNORE_READINGS 8 #define IGNORE_READINGS 5
NAU7802 myScale; //Create instance of the NAU7802 class NAU7802 myScale; //Create instance of the NAU7802 class