deep sleep (experimental)

This commit is contained in:
Verkehrsrot committed 2019-10-16 21:14:34 +02:00
1 parent 0bc368c228
commit f75cdd4f5c
16 files changed
+238 -98

No files matched your search

+2 -1
View File
@@ -7,7 +7,8 @@
extern uint8_t DisplayIsOn;
void refreshTheDisplay(bool nextPage = false);
void init_display(uint8_t verbose = 0);
void init_display(bool verbose = false);
void shutdown_display(void);
void draw_page(time_t t, uint8_t page);
void dp_printf(uint16_t x, uint16_t y, uint8_t font, uint8_t inv,
const char *format, ...);
+5
View File
@@ -51,6 +51,11 @@
enum sendprio_t { prio_low, prio_normal, prio_high };
enum timesource_t { _gps, _rtc, _lora, _unsynced };
enum runmode_t {
RUNMODE_NORMAL,
RUNMODE_UPDATE,
RUNMODE_WAKEUP
};
// Struct holding devices's runtime configuration
typedef struct {
+4 -2
View File
@@ -1,5 +1,5 @@
#ifndef _I2CSCAN_H
#define _I2CSCAN_H
#ifndef _I2C_H
#define _I2C_H
#include <Arduino.h>
@@ -11,6 +11,8 @@
#define MCP_24AA02E64_PRIMARY_ADDRESS (0x50)
#define QUECTEL_GPS_PRIMARY_ADDRESS (0x10)
void i2c_init(void);
void i2c_deinit(void);
int i2c_scan(void);
#endif
+2 -1
View File
@@ -21,6 +21,7 @@
#endif
extern TaskHandle_t lmicTask, lorasendTask;
extern RTC_DATA_ATTR int RTCseqnoUp, RTCseqnoDn;
// table of LORAWAN MAC commands
typedef struct {
@@ -29,7 +30,7 @@ typedef struct {
const uint8_t params;
} mac_t;
esp_err_t lora_stack_init();
esp_err_t lora_stack_init(bool joined = false);
void lora_setupForNetwork(bool preJoin);
void lmictask(void *pvParameters);
void gen_lora_deveui(uint8_t *pdeveui);
+2 -1
View File
@@ -8,7 +8,7 @@
#include "globals.h"
#include "power.h"
#include "i2cscan.h"
#include "i2c.h"
#include "blescan.h"
#include "wifiscan.h"
#include "configmanager.h"
@@ -18,6 +18,7 @@
#include "irqhandler.h"
#include "led.h"
#include "spislave.h"
#if (HAS_LORA)
#include "lorawan.h"
#endif
+7 -2
View File
@@ -3,19 +3,24 @@
#include <Arduino.h>
#include <driver/adc.h>
#include <driver/rtc_io.h>
#include <esp_adc_cal.h>
#include "i2cscan.h"
#include "i2c.h"
#define DEFAULT_VREF 1100 // tbd: use adc2_vref_to_gpio() for better estimate
#define NO_OF_SAMPLES 64 // we do some multisampling to get better values
extern RTC_DATA_ATTR runmode_t RTC_runmode;
uint16_t read_voltage(void);
void calibrate_voltage(void);
bool batt_sufficient(void);
void enter_deepsleep(const int wakeup_sec, const gpio_num_t wakeup_gpio);
int exit_deepsleep(void);
#ifdef HAS_PMU
#include <axp20x.h>
void power_event_IRQ(void);
void AXP192_powerevent_IRQ(void);
void AXP192_power(bool on);
void AXP192_init(void);
void AXP192_showstatus(void);