commit
be59f97307
@ -518,7 +518,7 @@ Send for example `83` `86` as Downlink on Port 2 to get battery status and time/
|
||||
0x19 set sleep cycle
|
||||
|
||||
bytes 1..2 = device sleep cycle in seconds/10 (MSB), 1 ... 255
|
||||
e.g. {0x04, 0xB0} -> device sleeps 20 minutes after each send cycle [default = 0]
|
||||
e.g. {0x04, 0xB0} -> device sleeps 200 minutes after each send cycle [default = 0]
|
||||
|
||||
0x20 load device configuration
|
||||
|
||||
|
@ -8,19 +8,16 @@
|
||||
#include "power.h"
|
||||
#include "timekeeper.h"
|
||||
|
||||
#if (HAS_DISPLAY) == 1
|
||||
#include <OneBitDisplay.h>
|
||||
extern ONE_BIT_DISPLAY *dp;
|
||||
#elif (HAS_DISPLAY) == 2
|
||||
#include <bb_spi_lcd.h>
|
||||
extern BB_SPI_LCD *dp;
|
||||
#endif
|
||||
|
||||
#define DISPLAY_PAGES (7) // number of paxcounter display pages
|
||||
#define PLOTBUFFERSIZE (MY_DISPLAY_WIDTH * MY_DISPLAY_HEIGHT / 8)
|
||||
#define QR_VERSION 3 // 29 x 29px
|
||||
|
||||
// settings for OLED display library
|
||||
// Settings for OLED display library
|
||||
#if (HAS_DISPLAY) == 1
|
||||
|
||||
#include <OneBitDisplay.h>
|
||||
extern ONE_BIT_DISPLAY *dp;
|
||||
|
||||
#define MY_FONT_SMALL FONT_6x8
|
||||
#define MY_FONT_NORMAL FONT_8x8
|
||||
#define MY_FONT_LARGE FONT_16x32
|
||||
@ -30,17 +27,17 @@ extern BB_SPI_LCD *dp;
|
||||
#ifndef MY_DISPLAY_RST
|
||||
#define MY_DISPLAY_RST NOT_A_PIN
|
||||
#endif
|
||||
|
||||
#ifdef MY_DISPLAY_ADDR
|
||||
#define OLED_ADDR MY_DISPLAY_ADDR
|
||||
#else
|
||||
#define OLED_ADDR -1
|
||||
#endif
|
||||
|
||||
#ifndef OLED_FREQUENCY
|
||||
#define OLED_FREQUENCY 400000L
|
||||
#endif
|
||||
|
||||
#ifndef OLED_TYPE
|
||||
#define OLED_TYPE OLED_128x64
|
||||
#endif
|
||||
#ifndef MY_DISPLAY_FGCOLOR
|
||||
#define MY_DISPLAY_FGCOLOR 1 // OLED_WHITE
|
||||
#endif
|
||||
@ -48,19 +45,15 @@ extern BB_SPI_LCD *dp;
|
||||
#define MY_DISPLAY_BGCOLOR 0 // OLED_BLACK
|
||||
#endif
|
||||
|
||||
// settings for TFT display library
|
||||
#elif (HAS_DISPLAY) == 2
|
||||
// Settings for TFT display library
|
||||
#elif (HAS_DISPLAY) > 1
|
||||
|
||||
#define MY_FONT_SMALL 2
|
||||
#define MY_FONT_NORMAL 2
|
||||
#define MY_FONT_LARGE 2
|
||||
#define MY_FONT_STRETCHED 2
|
||||
#define MY_DISPLAY_FIRSTLINE 30
|
||||
#include <bb_spi_lcd.h>
|
||||
extern BB_SPI_LCD *dp;
|
||||
|
||||
#ifndef TFT_FREQUENCY
|
||||
#define TFT_FREQUENCY 400000L
|
||||
#endif
|
||||
|
||||
#ifndef MY_DISPLAY_FGCOLOR
|
||||
#define MY_DISPLAY_FGCOLOR TFT_YELLOW
|
||||
#endif
|
||||
@ -70,31 +63,39 @@ extern BB_SPI_LCD *dp;
|
||||
|
||||
#endif
|
||||
|
||||
// setup display hardware type, default is OLED 128x64
|
||||
#ifndef OLED_TYPE
|
||||
#define OLED_TYPE OLED_128x64
|
||||
// Fonts for large TFT display library
|
||||
#if (HAS_DISPLAY) == 2
|
||||
#define MY_FONT_SMALL FONT_12x16
|
||||
#define MY_FONT_NORMAL FONT_12x16
|
||||
#define MY_FONT_LARGE FONT_12x16
|
||||
#define MY_FONT_STRETCHED FONT_12x16
|
||||
#define MY_DISPLAY_FIRSTLINE 30
|
||||
#endif
|
||||
|
||||
// Settings for small TFT display library
|
||||
#if (HAS_DISPLAY) == 3
|
||||
#define MY_FONT_SMALL FONT_6x8
|
||||
#define MY_FONT_NORMAL FONT_8x8
|
||||
#define MY_FONT_LARGE FONT_16x16
|
||||
#define MY_FONT_STRETCHED FONT_12x16
|
||||
#define MY_DISPLAY_FIRSTLINE 30
|
||||
#endif
|
||||
|
||||
// Default settings for all display types
|
||||
#ifndef MY_DISPLAY_FLIP
|
||||
#define MY_DISPLAY_FLIP 0
|
||||
#endif
|
||||
|
||||
#ifndef MY_DISPLAY_WIDTH
|
||||
#define MY_DISPLAY_WIDTH 128 // Width in pixels of OLED-display, must be 32X
|
||||
#define MY_DISPLAY_WIDTH 128
|
||||
#endif
|
||||
#ifndef MY_DISPLAY_HEIGHT
|
||||
#define MY_DISPLAY_HEIGHT 64 // Height in pixels of OLED-display, must be 64X
|
||||
#define MY_DISPLAY_HEIGHT 64
|
||||
#endif
|
||||
|
||||
#ifndef MY_DISPLAY_FIRSTLINE
|
||||
#define MY_DISPLAY_FIRSTLINE 0
|
||||
#endif
|
||||
|
||||
// settings for qr code generator
|
||||
#define QR_VERSION 3 // 29 x 29px
|
||||
|
||||
const uint8_t QR_SCALEFACTOR = (MY_DISPLAY_HEIGHT - 4) / 29; // 4px borderlines
|
||||
|
||||
extern uint8_t DisplayIsOn;
|
||||
extern hw_timer_t *displayIRQ;
|
||||
extern uint8_t volatile channel; // wifi channel rotation counter
|
||||
|
@ -25,7 +25,7 @@ extern char lmic_event_msg[LMIC_EVENTMSG_LEN]; // display buffer
|
||||
|
||||
esp_err_t lmic_init(void);
|
||||
void lora_setupForNetwork(bool preJoin);
|
||||
void SaveLMICToRTC(int deepsleep_sec);
|
||||
void SaveLMICToRTC(uint32_t deepsleep_sec);
|
||||
void LoadLMICFromRTC();
|
||||
void lmictask(void *pvParameters);
|
||||
void gen_lora_deveui(uint8_t *pdeveui);
|
||||
|
@ -14,8 +14,7 @@
|
||||
void reset_rtc_vars(void);
|
||||
void do_reset(bool warmstart);
|
||||
void do_after_reset(void);
|
||||
void enter_deepsleep(const uint64_t wakeup_sec = 60,
|
||||
const gpio_num_t wakeup_gpio = GPIO_NUM_MAX);
|
||||
void enter_deepsleep(const uint32_t wakeup_sec, const gpio_num_t wakeup_gpio);
|
||||
unsigned long long uptime(void);
|
||||
|
||||
enum runmode_t {
|
||||
|
@ -46,7 +46,7 @@ description = Paxcounter is a device for metering passenger flows in realtime. I
|
||||
|
||||
[common]
|
||||
; for release_version use max. 10 chars total, use any decimal format like "a.b.c"
|
||||
release_version = 3.4.1
|
||||
release_version = 3.4.3
|
||||
; DEBUG LEVEL: For production run set to 0, otherwise device will leak RAM while running!
|
||||
; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose
|
||||
debug_level = 3
|
||||
|
@ -10,7 +10,7 @@ description = Paxcounter is a device for metering passenger flows in realtime. I
|
||||
|
||||
[common]
|
||||
; for release_version use max. 10 chars total, use any decimal format like "a.b.c"
|
||||
release_version = 3.4.1
|
||||
release_version = 3.4.3
|
||||
; DEBUG LEVEL: For production run set to 0, otherwise device will leak RAM while running!
|
||||
; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose
|
||||
debug_level = 3
|
||||
|
@ -37,7 +37,7 @@ static void defaultConfig(configData_t *myconfig) {
|
||||
myconfig->screenon = 1; // 0=disabled, 1=enabled
|
||||
myconfig->countermode =
|
||||
COUNTERMODE; // 0=cyclic, 1=cumulative, 2=cyclic confirmed
|
||||
myconfig->rssilimit = 0; // threshold for rssilimiter, negative value!
|
||||
myconfig->rssilimit = RSSILIMIT; // threshold for rssilimiter, negative value!
|
||||
myconfig->sendcycle = SENDCYCLE; // payload send cycle [seconds/2]
|
||||
myconfig->sleepcycle = SLEEPCYCLE; // sleep cycle [seconds/10]
|
||||
myconfig->wifichancycle =
|
||||
|
@ -49,7 +49,7 @@ static QRCode qrcode;
|
||||
#ifdef HAS_DISPLAY
|
||||
#if (HAS_DISPLAY) == 1
|
||||
ONE_BIT_DISPLAY *dp = NULL;
|
||||
#elif (HAS_DISPLAY) == 2
|
||||
#elif (HAS_DISPLAY) > 1
|
||||
BB_SPI_LCD *dp = NULL;
|
||||
#else
|
||||
#error Unknown display type specified in hal file
|
||||
@ -66,15 +66,15 @@ void dp_setup(int contrast) {
|
||||
dp->allocBuffer(); // render all outputs to lib internal backbuffer
|
||||
dp->setTextWrap(false);
|
||||
dp->setRotation(
|
||||
MY_DISPLAY_FLIP ? 2 : 0); // 0 = no rotation, 1 = 90°, 2 = 180°, 3 = 280°
|
||||
MY_DISPLAY_FLIP ? 2 : 0); // 0 = no rotation, 1 = 90°, 2 = 180°, 3 = 270°
|
||||
|
||||
#elif (HAS_DISPLAY) == 2 // TFT LCD
|
||||
#elif (HAS_DISPLAY) > 1 // TFT LCD
|
||||
|
||||
dp = new BB_SPI_LCD;
|
||||
dp->begin(TFT_TYPE);
|
||||
dp->allocBuffer(); // render all outputs to lib internal backbuffer
|
||||
dp->setRotation(
|
||||
MY_DISPLAY_FLIP ? 1 : 3); // 0 = no rotation, 1 = 90°, 2 = 180°, 3 = 280°
|
||||
MY_DISPLAY_FLIP ? 1 : 3); // 0 = no rotation, 1 = 90°, 2 = 180°, 3 = 270°
|
||||
dp->setTextColor(MY_DISPLAY_FGCOLOR, MY_DISPLAY_BGCOLOR);
|
||||
|
||||
#endif
|
||||
@ -421,7 +421,7 @@ void dp_clear(void) {
|
||||
void dp_contrast(uint8_t contrast) {
|
||||
#if (HAS_DISPLAY) == 1
|
||||
dp->setContrast(contrast);
|
||||
#elif (HAS_DISPLAY) == 2
|
||||
#elif (HAS_DISPLAY) > 1
|
||||
// to do: gamma correction for TFT
|
||||
#endif
|
||||
}
|
||||
@ -429,7 +429,7 @@ void dp_contrast(uint8_t contrast) {
|
||||
void dp_power(uint8_t screenon) {
|
||||
#if (HAS_DISPLAY) == 1
|
||||
dp->setPower(screenon);
|
||||
#elif (HAS_DISPLAY) == 2
|
||||
#elif (HAS_DISPLAY) > 1
|
||||
// to come
|
||||
#endif
|
||||
}
|
||||
@ -438,7 +438,7 @@ void dp_shutdown(void) {
|
||||
#if (HAS_DISPLAY) == 1
|
||||
dp->setPower(false);
|
||||
delay(DISPLAYREFRESH_MS / 1000 * 1.1);
|
||||
#elif (HAS_DISPLAY) == 2
|
||||
#elif (HAS_DISPLAY) > 1
|
||||
// to come
|
||||
#endif
|
||||
}
|
||||
|
@ -18,17 +18,10 @@
|
||||
#define SDCARD_SLOTWIDTH 4 // dongle has 4 line interface
|
||||
#define SDCARD_SLOTCONFIG { .clk = GPIO_NUM_12, .cmd = GPIO_NUM_16, .d0 = GPIO_NUM_14, .d1 = GPIO_NUM_17, .d2 = GPIO_NUM_21, .d3 = GPIO_NUM_18, .cd = SDMMC_SLOT_NO_CD, .wp = SDMMC_SLOT_NO_WP, .width = 4, .flags = 0, }
|
||||
|
||||
#define HAS_DISPLAY 2 // TFT-LCD
|
||||
#define TFT_TYPE DISPLAY_T_DISPLAY_S3 // may currently not work, we are awaiting a PR for display lib
|
||||
#define HAS_DISPLAY 3 // TFT-LCD
|
||||
#define TFT_TYPE DISPLAY_T_DONGLE_S3
|
||||
#define MY_DISPLAY_FLIP 1 // use if display is rotated
|
||||
#define MY_DISPLAY_WIDTH 80
|
||||
#define MY_DISPLAY_HEIGHT 160
|
||||
|
||||
#define TFT_CS_PIN 4
|
||||
#define TFT_SDA_PIN 3
|
||||
#define TFT_SCL_PIN 5
|
||||
#define TFT_DC_PIN 2
|
||||
#define TFT_RES_PIN 1
|
||||
#define TFT_LEDA_PIN 38
|
||||
|
||||
#endif
|
@ -76,9 +76,9 @@ void irqHandler(void *pvParameters) {
|
||||
// goto sleep if we have a sleep cycle
|
||||
if (cfg.sleepcycle)
|
||||
#ifdef HAS_BUTTON
|
||||
enter_deepsleep(cfg.sleepcycle * 10, (gpio_num_t)HAS_BUTTON);
|
||||
enter_deepsleep(cfg.sleepcycle * 10UL, (gpio_num_t)HAS_BUTTON);
|
||||
#else
|
||||
enter_deepsleep(cfg.sleepcycle * 10);
|
||||
enter_deepsleep(cfg.sleepcycle * 10UL, GPIO_NUM_MAX);
|
||||
#endif
|
||||
}
|
||||
} // for
|
||||
|
@ -501,7 +501,7 @@ bool ttn_rtc_restore() {
|
||||
// following code includes snippets taken from
|
||||
// https://github.com/JackGruber/ESP32-LMIC-DeepSleep-example/blob/master/src/main.cpp
|
||||
|
||||
void SaveLMICToRTC(int deepsleep_sec) {
|
||||
void SaveLMICToRTC(uint32_t deepsleep_sec) {
|
||||
// ESP32 can't track millis during DeepSleep and no option to advance
|
||||
// millis after DeepSleep. Therefore reset DutyCyles before saving LMIC struct
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
// MAC sniffing parameters
|
||||
#define BLECOUNTER 1 // set to 0 if you do not want to install the BLE sniffer
|
||||
#define WIFICOUNTER 1 // set to 0 if you do not want to install the WIFI sniffer
|
||||
#define RSSILIMIT 0 // 0...-128, set to 0 if you do not want to filter signals
|
||||
|
||||
// BLE scan parameters
|
||||
#define BLESCANTIME 0 // [seconds] scan duration, 0 means infinite [default], see note below
|
||||
|
@ -57,7 +57,7 @@ void AXP192_powerevent_IRQ(void) {
|
||||
#ifdef HAS_BUTTON
|
||||
// short press -> esp32 deep sleep mode, must be exited by user button
|
||||
if (pmu.isPekeyShortPressIrq())
|
||||
enter_deepsleep(0, HAS_BUTTON);
|
||||
enter_deepsleep(0UL, HAS_BUTTON);
|
||||
#endif
|
||||
|
||||
pmu.clearIrqStatus();
|
||||
|
@ -84,7 +84,7 @@ void do_after_reset(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void enter_deepsleep(const uint64_t wakeup_sec, gpio_num_t wakeup_gpio) {
|
||||
void enter_deepsleep(const uint32_t wakeup_sec, gpio_num_t wakeup_gpio) {
|
||||
ESP_LOGI(TAG, "Preparing to sleep...");
|
||||
|
||||
RTC_runmode = RUNMODE_SLEEP;
|
||||
|
@ -216,6 +216,8 @@ void sdcard_flush(void) {
|
||||
}
|
||||
|
||||
void sdcard_close(void) {
|
||||
if (!useSDCard)
|
||||
return;
|
||||
ESP_LOGI(TAG, "closing SD-card");
|
||||
sdcard_flush();
|
||||
#ifdef SD_LOGGING
|
||||
|
Loading…
Reference in New Issue
Block a user