Merge pull request #172 from cyberman54/development

v1.5.13
This commit is contained in:
Verkehrsrot 2018-09-30 22:07:08 +02:00 committed by GitHub
commit 686571edd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 17 additions and 18 deletions

View File

@ -26,7 +26,7 @@ description = Paxcounter is a proof-of-concept ESP32 device for metering passeng
[common]
; for release_version use max. 10 chars total, use any decimal format like "a.b.c"
release_version = 1.5.9
release_version = 1.5.13
; 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 = 0

View File

@ -6,6 +6,8 @@
// Local logging tag
static const char TAG[] = "main";
portMUX_TYPE mutexButton = portMUX_INITIALIZER_UNLOCKED;
void IRAM_ATTR ButtonIRQ() {
portENTER_CRITICAL(&mutexButton);
ButtonPressedIRQ++;

View File

@ -9,6 +9,8 @@
// Local logging tag
static const char TAG[] = "main";
portMUX_TYPE mutexHomeCycle = portMUX_INITIALIZER_UNLOCKED;
// do all housekeeping
void doHousekeeping() {

View File

@ -15,6 +15,8 @@ const char lora_datarate[] = {"100908078CNA121110090807"};
uint8_t volatile DisplayState = 0;
portMUX_TYPE mutexDisplay = portMUX_INITIALIZER_UNLOCKED;
// helper function, prints a hex key on display
void DisplayKey(const uint8_t *key, uint8_t len, bool lsb) {
const uint8_t *p;

View File

@ -46,7 +46,6 @@ extern uint16_t volatile macs_total, macs_wifi, macs_ble,
batt_voltage; // display values
extern std::set<uint16_t> macs; // temp storage for MACs
extern hw_timer_t *channelSwitch, *sendCycle;
extern portMUX_TYPE mutexButton, mutexDisplay, mutexHomeCycle, mutexSendCycle;
extern volatile uint8_t SendCycleTimerIRQ, HomeCycleIRQ, DisplayTimerIRQ,
ChannelTimerIRQ, ButtonPressedIRQ;

View File

@ -3,7 +3,7 @@
#define HAS_LORA 1 // comment out if device shall not send data via LoRa
#define HAS_SPI 1 // comment out if device shall not send data via SPI
#define CFG_sx1276_radio 1
#define HAS_LED NOT_A_PIN // LoPy4 has no on board mono LED, we use on board RGB LED
//#define HAS_LED NOT_A_PIN // LoPy4 has no on board mono LED, we use on board RGB LED
#define HAS_RGB_LED GPIO_NUM_0 // WS2812B RGB LED on GPIO0
#define BOARD_HAS_PSRAM // use extra 4MB extern RAM

View File

@ -7,6 +7,7 @@
#define HAS_SPI 1 // comment out if device shall not send data via SPI
#define CFG_sx1276_radio 1 // HPD13A LoRa SoC
#define HAS_LED NOT_A_PIN // no usable LED on board
#define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature
#define HAS_DISPLAY U8X8_SSD1306_128X64_NONAME_HW_I2C
//#define DISPLAY_FLIP 1 // rotated display

View File

@ -30,7 +30,7 @@ Task Core Prio Purpose
IDLE 0 0 ESP32 arduino scheduler -> runs wifi sniffer task
gpsloop 0 2 read data from GPS over serial or i2c
IDLE 1 0 Arduino loop() -> used for LED switching
loraloop 1 3 runs the LMIC stack
loraloop 1 2 runs the LMIC stack
statemachine 1 1 switches application process logic
wifiloop 0 4 rotates wifi channels
@ -77,12 +77,6 @@ QueueHandle_t SPISendQueue;
TaskHandle_t GpsTask = NULL;
#endif
// sync main loop and ISR when modifying IRQ handler shared variables
portMUX_TYPE mutexButton = portMUX_INITIALIZER_UNLOCKED;
portMUX_TYPE mutexDisplay = portMUX_INITIALIZER_UNLOCKED;
portMUX_TYPE mutexHomeCycle = portMUX_INITIALIZER_UNLOCKED;
portMUX_TYPE mutexSendCycle = portMUX_INITIALIZER_UNLOCKED;
std::set<uint16_t> macs; // container holding unique MAC adress hashes
// initialize payload encoder
@ -312,9 +306,9 @@ void setup() {
ESP_LOGI(TAG, "Starting Lora...");
xTaskCreatePinnedToCore(lorawan_loop, /* task function */
"loraloop", /* name of task */
2560, /* stack size of task */
3048, /* stack size of task */
(void *)1, /* parameter of the task */
3, /* priority of the task */
2, /* priority of the task */
&LoraTask, /* task handle*/
1); /* CPU core */
#endif
@ -352,7 +346,7 @@ void setup() {
// start wifi channel rotation task
xTaskCreatePinnedToCore(switchWifiChannel, /* task function */
"wifiloop", /* name of task */
1536, /* stack size of task */
2048, /* stack size of task */
NULL, /* parameter of the task */
4, /* priority of the task */
&wifiSwitchTask, /* task handle*/

View File

@ -1,6 +1,8 @@
// Basic Config
#include "globals.h"
portMUX_TYPE mutexSendCycle = portMUX_INITIALIZER_UNLOCKED;
// put data to send in RTos Queues used for transmit over channels Lora and SPI
void SendData(uint8_t port) {

View File

@ -33,9 +33,6 @@ void wifi_sniffer_init(void) {
// .filter_mask = WIFI_PROMIS_FILTER_MASK_MGMT}; // only MGMT frames
.filter_mask = WIFI_PROMIS_FILTER_MASK_ALL}; // we use all frames
// esp_event_loop_init(NULL, NULL);
// ESP_ERROR_CHECK(esp_event_loop_init(event_handler, NULL));
ESP_ERROR_CHECK(esp_wifi_init(&cfg)); // configure Wifi with cfg
ESP_ERROR_CHECK(
esp_wifi_set_country(&wifi_country)); // set locales for RF and channels
@ -50,7 +47,7 @@ void wifi_sniffer_init(void) {
}
// IRQ Handler
void ChannelSwitchIRQ() {
void IRAM_ATTR ChannelSwitchIRQ() {
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
// unblock wifi channel rotation task
xSemaphoreGiveFromISR(xWifiChannelSwitchSemaphore, &xHigherPriorityTaskWoken);

View File

@ -27,7 +27,7 @@ typedef struct {
void wifi_sniffer_init(void);
void IRAM_ATTR wifi_sniffer_packet_handler(void *buff, wifi_promiscuous_pkt_type_t type);
void ChannelSwitchIRQ(void);
void IRAM_ATTR ChannelSwitchIRQ(void);
void switchWifiChannel(void * parameter);
#endif