-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Complete re-write of application code for low power.
- Loading branch information
1 parent
94af03c
commit 5f1c6d5
Showing
43 changed files
with
2,099 additions
and
35,646 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,3 @@ | |
.vscode/launch.json | ||
.vscode/ipch | ||
Generated | ||
Debug-Build |
32,913 changes: 0 additions & 32,913 deletions
32,913
Flash-Files/WisBlock_Comfort_V1.0.0_23.08.16_14.38_full.hex
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/** | ||
* @file cayenne_lpp.h | ||
* @author Bernd Giesecke ([email protected]) | ||
* @brief Defines for RAK Cayenne LPP packet format | ||
* @version 0.1 | ||
* @date 2024-02-08 | ||
* | ||
* @copyright Copyright (c) 2024 | ||
* | ||
*/ | ||
#ifndef _CAYENNE_LPP_H_ | ||
#define _CAYENNE_LPP_H_ | ||
#include <Arduino.h> | ||
|
||
// Cayenne LPP Channel numbers per sensor value | ||
#define LPP_CHANNEL_BATT 1 // Base Board | ||
#define LPP_CHANNEL_HUMID 2 // RAK1901 | ||
#define LPP_CHANNEL_TEMP 3 // RAK1901 | ||
#define LPP_CHANNEL_PRESS 4 // RAK1902 | ||
#define LPP_CHANNEL_LIGHT 5 // RAK1903 | ||
#define LPP_CHANNEL_HUMID_2 6 // RAK1906 | ||
#define LPP_CHANNEL_TEMP_2 7 // RAK1906 | ||
#define LPP_CHANNEL_PRESS_2 8 // RAK1906 | ||
#define LPP_CHANNEL_GAS_2 9 // RAK1906 | ||
#define LPP_CHANNEL_GPS 10 // RAK1910/RAK12500 | ||
#define LPP_CHANNEL_SOIL_TEMP 11 // RAK12035 | ||
#define LPP_CHANNEL_SOIL_HUMID 12 // RAK12035 | ||
#define LPP_CHANNEL_SOIL_HUMID_RAW 13 // RAK12035 | ||
#define LPP_CHANNEL_SOIL_VALID 14 // RAK12035 | ||
#define LPP_CHANNEL_LIGHT2 15 // RAK12010 | ||
#define LPP_CHANNEL_VOC 16 // RAK12047 | ||
#define LPP_CHANNEL_GAS 17 // RAK12004 | ||
#define LPP_CHANNEL_GAS_PERC 18 // RAK12004 | ||
#define LPP_CHANNEL_CO2 19 // RAK12008 | ||
#define LPP_CHANNEL_CO2_PERC 20 // RAK12008 | ||
#define LPP_CHANNEL_ALC 21 // RAK12009 | ||
#define LPP_CHANNEL_ALC_PERC 22 // RAK12009 | ||
#define LPP_CHANNEL_TOF 23 // RAK12014 | ||
#define LPP_CHANNEL_TOF_VALID 24 // RAK12014 | ||
#define LPP_CHANNEL_GYRO 25 // RAK12025 | ||
#define LPP_CHANNEL_GESTURE 26 // RAK14008 | ||
#define LPP_CHANNEL_UVI 27 // RAK12019 | ||
#define LPP_CHANNEL_UVS 28 // RAK12019 | ||
#define LPP_CHANNEL_CURRENT_CURRENT 29 // RAK16000 | ||
#define LPP_CHANNEL_CURRENT_VOLTAGE 30 // RAK16000 | ||
#define LPP_CHANNEL_CURRENT_POWER 31 // RAK16000 | ||
#define LPP_CHANNEL_TOUCH_1 32 // RAK14002 | ||
#define LPP_CHANNEL_TOUCH_2 33 // RAK14002 | ||
#define LPP_CHANNEL_TOUCH_3 34 // RAK14002 | ||
#define LPP_CHANNEL_CO2_2 35 // RAK12037 | ||
#define LPP_CHANNEL_CO2_Temp_2 36 // RAK12037 | ||
#define LPP_CHANNEL_CO2_HUMID_2 37 // RAK12037 | ||
#define LPP_CHANNEL_TEMP_3 38 // RAK12003 | ||
#define LPP_CHANNEL_TEMP_4 39 // RAK12003 | ||
#define LPP_CHANNEL_PM_1_0 40 // RAK12039 | ||
#define LPP_CHANNEL_PM_2_5 41 // RAK12039 | ||
#define LPP_CHANNEL_PM_10_0 42 // RAK12039 | ||
|
||
extern WisCayenne g_solution_data; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* @file debug.h | ||
* @author Bernd Giesecke ([email protected]) | ||
* @brief Defines for Debug output | ||
* @version 0.1 | ||
* @date 2024-02-08 | ||
* | ||
* @copyright Copyright (c) 2024 | ||
* | ||
*/ | ||
#ifndef _DEBUG_H_ | ||
#define _DEBUG_H_ | ||
|
||
#include <Arduino.h> | ||
|
||
// Debug output set to 0 to disable app debug output | ||
#ifndef MY_DEBUG | ||
#define MY_DEBUG 0 | ||
#endif | ||
|
||
#if MY_DEBUG > 0 | ||
#define MYLOG(tag, ...) \ | ||
do \ | ||
{ \ | ||
if (tag) \ | ||
PRINTF("[%s] ", tag); \ | ||
PRINTF(__VA_ARGS__); \ | ||
PRINTF("\n"); \ | ||
Serial.flush(); \ | ||
if (g_ble_uart_is_connected) \ | ||
{ \ | ||
g_ble_uart.printf(__VA_ARGS__); \ | ||
g_ble_uart.printf("\n"); \ | ||
} \ | ||
} while (0) | ||
#else | ||
#define MYLOG(...) | ||
#endif | ||
|
||
#endif // _DEBUG_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
/** | ||
* @file main.h | ||
* @author Bernd Giesecke ([email protected]) | ||
* @brief Defines and includes | ||
* @version 0.1 | ||
* @date 2024-02-13 | ||
* | ||
* @copyright Copyright (c) 2024 | ||
* | ||
*/ | ||
#ifndef _MAIN_H_ | ||
#define _MAIN_H_ | ||
#include <Arduino.h> | ||
#include <WisBlock-API-V2.h> | ||
#include <wisblock_cayenne.h> | ||
#include "cayenne_lpp.h" | ||
#include "modules.h" | ||
#include <nrfx_power.h> | ||
#include "debug.h" | ||
#include "RAK14000_epd.h" | ||
|
||
// RAK19024 Base Board | ||
#define PIR_INT 25 // Interrupt pin for PIR | ||
#define BUTTON_INT 24 // Input pin for Button | ||
#define VOC_POWER 20 // VOC power enable pin | ||
#define PIR_POWER 2 // PIR power enable pin | ||
#define CO2_PM_POWER 28 // CO2 and PM power enable pin | ||
#define EPD_POWER 34 // EPD power enable pin | ||
#define SET_PIN WB_IO6 // PM sensor enable pin | ||
|
||
/** Wakeup triggers for application events */ | ||
#define MOTION 0b1000000000000000 | ||
#define N_MOTION 0b0111111111111111 | ||
#define SEND_NOW 0b0100000000000000 | ||
#define N_SEND_NOW 0b1011111111111111 | ||
#define VOC_REQ 0b0010000000000000 | ||
#define N_VOC_REQ 0b1101111111111111 | ||
#define ROOM_EMPTY 0b0001000000000000 | ||
#define N_ROOM_EMPTY 0b1110111111111111 | ||
#define LED_REQ 0b0000100000000000 | ||
#define N_LED_REQ 0b1111011111111111 | ||
#define DISP_UPDATE 0b0000010000000000 | ||
#define N_DISP_UPDATE 0b1111101111111111 | ||
#define DISP_JOIN 0b0000001000000000 | ||
#define N_DISP_JOIN 0b1111110111111111 | ||
#define RST_REQ 0b0000000100000000 | ||
#define N_RST_REQ 0b1111111011111111 | ||
#define APP_EVENT 0b1111111110000001 | ||
|
||
// Structures and Unions | ||
/** RTC date/time structure */ | ||
struct date_time_s | ||
{ | ||
uint16_t year; | ||
uint8_t month; | ||
uint8_t weekday; | ||
uint8_t date; | ||
uint8_t hour; | ||
uint8_t minute; | ||
uint8_t second; | ||
}; | ||
|
||
/** Define the version of your SW */ | ||
#ifndef SW_VERSION_1 | ||
#define SW_VERSION_1 1 // major version increase on API change / not backwards compatible | ||
#define SW_VERSION_2 0 // minor version increase on API change / backward compatible | ||
#define SW_VERSION_3 0 // patch version increase on bugfix, no affect on API | ||
#endif | ||
|
||
// Forward declarations | ||
void send_delayed(TimerHandle_t unused); | ||
void init_user_at(void); | ||
void read_batt_settings(void); | ||
void save_batt_settings(bool check_batt_enables); | ||
void read_ui_settings(void); | ||
void save_ui_settings(uint8_t ui_selected); | ||
|
||
// Global Variables | ||
extern WisCayenne g_solution_data; | ||
extern date_time_s g_date_time; | ||
extern SoftwareTimer g_sensor_timer; | ||
extern SoftwareTimer voc_read_timer; | ||
extern SoftwareTimer g_rgb_timer; | ||
extern SoftwareTimer g_epd_off_timer; | ||
extern bool has_rak1901; | ||
extern bool has_rak1902; | ||
extern bool has_rak1903; | ||
extern bool has_rak1906; | ||
extern bool has_rak12002; | ||
extern bool has_rak12010; | ||
extern bool has_rak12019; | ||
extern bool has_rak12037; | ||
extern bool has_rak12039; | ||
extern bool has_rak12047; | ||
extern bool g_has_rgb; | ||
extern bool g_voc_valid; | ||
extern float g_last_temp; | ||
extern float g_last_humid; | ||
extern float g_last_pressure; | ||
extern float g_last_light_lux; | ||
extern uint8_t g_ui_selected; | ||
extern uint8_t g_ui_last; | ||
extern uint8_t g_air_status; | ||
extern bool g_status_changed; | ||
extern bool g_occupied; | ||
extern bool g_is_using_battery; | ||
extern bool g_rgb_on; | ||
extern time_t g_app_start_time; | ||
|
||
#endif |
Oops, something went wrong.