v1.5.13
This commit is contained in:
		
							parent
							
								
									16efbb0c90
								
							
						
					
					
						commit
						15f7f2fd85
					
				| @ -26,7 +26,7 @@ description = Paxcounter is a proof-of-concept ESP32 device for metering passeng | |||||||
| 
 | 
 | ||||||
| [common] | [common] | ||||||
| ; for release_version use max. 10 chars total, use any decimal format like "a.b.c" | ; 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! | ; 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 | ; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose | ||||||
| debug_level = 0 | debug_level = 0 | ||||||
|  | |||||||
| @ -6,6 +6,8 @@ | |||||||
| // Local logging tag
 | // Local logging tag
 | ||||||
| static const char TAG[] = "main"; | static const char TAG[] = "main"; | ||||||
| 
 | 
 | ||||||
|  | portMUX_TYPE mutexButton = portMUX_INITIALIZER_UNLOCKED; | ||||||
|  | 
 | ||||||
| void IRAM_ATTR ButtonIRQ() { | void IRAM_ATTR ButtonIRQ() { | ||||||
|   portENTER_CRITICAL(&mutexButton); |   portENTER_CRITICAL(&mutexButton); | ||||||
|   ButtonPressedIRQ++; |   ButtonPressedIRQ++; | ||||||
|  | |||||||
| @ -9,6 +9,8 @@ | |||||||
| // Local logging tag
 | // Local logging tag
 | ||||||
| static const char TAG[] = "main"; | static const char TAG[] = "main"; | ||||||
| 
 | 
 | ||||||
|  | portMUX_TYPE mutexHomeCycle = portMUX_INITIALIZER_UNLOCKED; | ||||||
|  | 
 | ||||||
| // do all housekeeping
 | // do all housekeeping
 | ||||||
| void doHousekeeping() { | void doHousekeeping() { | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -15,6 +15,8 @@ const char lora_datarate[] = {"100908078CNA121110090807"}; | |||||||
| 
 | 
 | ||||||
| uint8_t volatile DisplayState = 0; | uint8_t volatile DisplayState = 0; | ||||||
| 
 | 
 | ||||||
|  | portMUX_TYPE mutexDisplay = portMUX_INITIALIZER_UNLOCKED; | ||||||
|  | 
 | ||||||
| // helper function, prints a hex key on display
 | // helper function, prints a hex key on display
 | ||||||
| void DisplayKey(const uint8_t *key, uint8_t len, bool lsb) { | void DisplayKey(const uint8_t *key, uint8_t len, bool lsb) { | ||||||
|   const uint8_t *p; |   const uint8_t *p; | ||||||
|  | |||||||
| @ -46,7 +46,6 @@ extern uint16_t volatile macs_total, macs_wifi, macs_ble, | |||||||
|     batt_voltage;               // display values
 |     batt_voltage;               // display values
 | ||||||
| extern std::set<uint16_t> macs; // temp storage for MACs
 | extern std::set<uint16_t> macs; // temp storage for MACs
 | ||||||
| extern hw_timer_t *channelSwitch, *sendCycle; | extern hw_timer_t *channelSwitch, *sendCycle; | ||||||
| extern portMUX_TYPE mutexButton, mutexDisplay, mutexHomeCycle, mutexSendCycle; |  | ||||||
| extern volatile uint8_t SendCycleTimerIRQ, HomeCycleIRQ, DisplayTimerIRQ, | extern volatile uint8_t SendCycleTimerIRQ, HomeCycleIRQ, DisplayTimerIRQ, | ||||||
|     ChannelTimerIRQ, ButtonPressedIRQ; |     ChannelTimerIRQ, ButtonPressedIRQ; | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										14
									
								
								src/main.cpp
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								src/main.cpp
									
									
									
									
									
								
							| @ -30,7 +30,7 @@ Task          Core  Prio  Purpose | |||||||
| IDLE          0     0     ESP32 arduino scheduler -> runs wifi sniffer task | IDLE          0     0     ESP32 arduino scheduler -> runs wifi sniffer task | ||||||
| gpsloop       0     2     read data from GPS over serial or i2c | gpsloop       0     2     read data from GPS over serial or i2c | ||||||
| IDLE          1     0     Arduino loop() -> used for LED switching | 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 | statemachine  1     1     switches application process logic | ||||||
| wifiloop      0     4     rotates wifi channels | wifiloop      0     4     rotates wifi channels | ||||||
| 
 | 
 | ||||||
| @ -77,12 +77,6 @@ QueueHandle_t SPISendQueue; | |||||||
| TaskHandle_t GpsTask = NULL; | TaskHandle_t GpsTask = NULL; | ||||||
| #endif | #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
 | std::set<uint16_t> macs; // container holding unique MAC adress hashes
 | ||||||
| 
 | 
 | ||||||
| // initialize payload encoder
 | // initialize payload encoder
 | ||||||
| @ -312,9 +306,9 @@ void setup() { | |||||||
|   ESP_LOGI(TAG, "Starting Lora..."); |   ESP_LOGI(TAG, "Starting Lora..."); | ||||||
|   xTaskCreatePinnedToCore(lorawan_loop, /* task function */ |   xTaskCreatePinnedToCore(lorawan_loop, /* task function */ | ||||||
|                           "loraloop",   /* name of task */ |                           "loraloop",   /* name of task */ | ||||||
|                           2560,         /* stack size of task */ |                           3048,         /* stack size of task */ | ||||||
|                           (void *)1,    /* parameter of the task */ |                           (void *)1,    /* parameter of the task */ | ||||||
|                           3,            /* priority of the task */ |                           2,            /* priority of the task */ | ||||||
|                           &LoraTask,    /* task handle*/ |                           &LoraTask,    /* task handle*/ | ||||||
|                           1);           /* CPU core */ |                           1);           /* CPU core */ | ||||||
| #endif | #endif | ||||||
| @ -352,7 +346,7 @@ void setup() { | |||||||
|   // start wifi channel rotation task
 |   // start wifi channel rotation task
 | ||||||
|   xTaskCreatePinnedToCore(switchWifiChannel, /* task function */ |   xTaskCreatePinnedToCore(switchWifiChannel, /* task function */ | ||||||
|                           "wifiloop",        /* name of task */ |                           "wifiloop",        /* name of task */ | ||||||
|                           1536,              /* stack size of task */ |                           2048,              /* stack size of task */ | ||||||
|                           NULL,              /* parameter of the task */ |                           NULL,              /* parameter of the task */ | ||||||
|                           4,                 /* priority of the task */ |                           4,                 /* priority of the task */ | ||||||
|                           &wifiSwitchTask,   /* task handle*/ |                           &wifiSwitchTask,   /* task handle*/ | ||||||
|  | |||||||
| @ -1,6 +1,8 @@ | |||||||
| // Basic Config
 | // Basic Config
 | ||||||
| #include "globals.h" | #include "globals.h" | ||||||
| 
 | 
 | ||||||
|  | portMUX_TYPE mutexSendCycle = portMUX_INITIALIZER_UNLOCKED; | ||||||
|  | 
 | ||||||
| // put data to send in RTos Queues used for transmit over channels Lora and SPI
 | // put data to send in RTos Queues used for transmit over channels Lora and SPI
 | ||||||
| void SendData(uint8_t port) { | void SendData(uint8_t port) { | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -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_MGMT}; // only MGMT frames
 | ||||||
|       .filter_mask = WIFI_PROMIS_FILTER_MASK_ALL}; // we use all 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_init(&cfg)); // configure Wifi with cfg
 | ||||||
|   ESP_ERROR_CHECK( |   ESP_ERROR_CHECK( | ||||||
|       esp_wifi_set_country(&wifi_country)); // set locales for RF and channels
 |       esp_wifi_set_country(&wifi_country)); // set locales for RF and channels
 | ||||||
| @ -50,7 +47,7 @@ void wifi_sniffer_init(void) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // IRQ Handler
 | // IRQ Handler
 | ||||||
| void ChannelSwitchIRQ() { | void IRAM_ATTR ChannelSwitchIRQ() { | ||||||
|   BaseType_t xHigherPriorityTaskWoken = pdFALSE; |   BaseType_t xHigherPriorityTaskWoken = pdFALSE; | ||||||
|   // unblock wifi channel rotation task
 |   // unblock wifi channel rotation task
 | ||||||
|   xSemaphoreGiveFromISR(xWifiChannelSwitchSemaphore, &xHigherPriorityTaskWoken); |   xSemaphoreGiveFromISR(xWifiChannelSwitchSemaphore, &xHigherPriorityTaskWoken); | ||||||
|  | |||||||
| @ -27,7 +27,7 @@ typedef struct { | |||||||
| 
 | 
 | ||||||
| void wifi_sniffer_init(void); | void wifi_sniffer_init(void); | ||||||
| void IRAM_ATTR wifi_sniffer_packet_handler(void *buff, wifi_promiscuous_pkt_type_t type); | 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); | void switchWifiChannel(void * parameter); | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user