From 165aa75ab3e4d6a33c63496c74cd5d7483e580d5 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Wed, 4 Jul 2018 00:09:25 +0200 Subject: [PATCH] step 1 migrations to Espressif 1.1.0 core --- platformio.ini | 8 ++++---- src/blecsan.cpp | 12 ++---------- src/hal/ttgov21.h | 6 +++--- src/macsniff.cpp | 9 ++++----- src/main.h | 2 +- src/paxcounter.conf | 3 +-- 6 files changed, 15 insertions(+), 25 deletions(-) diff --git a/platformio.ini b/platformio.ini index 797a0724..b2e9cb52 100644 --- a/platformio.ini +++ b/platformio.ini @@ -11,9 +11,9 @@ ; ---> SELECT TARGET PLATFORM HERE! <--- [platformio] -env_default = heltec +;env_default = heltec ;env_default = ttgov1 -;env_default = ttgov2 +env_default = ttgov2 ;env_default = ttgov21 ;env_default = ttgobeam ;env_default = lopy @@ -25,11 +25,11 @@ env_default = heltec description = Paxcounter is a proof-of-concept ESP32 device for metering passenger flows in realtime. It counts how many mobile devices are around. [common_env_data] -platform_espressif32 = espressif32@1.0.2 +platform_espressif32 = espressif32@1.1.0 board_build.partitions = no_ota.csv lib_deps_all = lib_deps_display = - U8g2@>=2.22.14 + U8g2@>=2.23.12 lib_deps_rgbled = SmartLeds@>=1.1.3 lib_deps_gps = diff --git a/src/blecsan.cpp b/src/blecsan.cpp index bfefc948..42e4c197 100644 --- a/src/blecsan.cpp +++ b/src/blecsan.cpp @@ -249,14 +249,7 @@ void start_BLEscan(void) { ESP_LOGI(TAG, "Initializing bluetooth scanner ..."); // Initialize BT controller to allocate task and other resource. - esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT(); - bt_cfg.controller_task_stack_size = - BLESTACKSIZE; // set BT stack size to value configured in paxcounter.conf - ESP_ERROR_CHECK(esp_bt_controller_init(&bt_cfg)); - ESP_ERROR_CHECK(esp_bt_controller_enable(ESP_BT_MODE_BTDM)); - - // Init and alloc the resource for bluetooth stack, must be done prior to - // every bluetooth stuff + btStart(); ESP_ERROR_CHECK(esp_bluedroid_init()); ESP_ERROR_CHECK(esp_bluedroid_enable()); @@ -271,8 +264,7 @@ void stop_BLEscan(void) { ESP_ERROR_CHECK(esp_ble_gap_register_callback(NULL)); ESP_ERROR_CHECK(esp_bluedroid_disable()); ESP_ERROR_CHECK(esp_bluedroid_deinit()); - ESP_ERROR_CHECK(esp_bt_controller_disable()); - ESP_ERROR_CHECK(esp_bt_controller_deinit()); + btStop(); // disable & deinit bt_controller ESP_LOGI(TAG, "Bluetooth scanner stopped"); } // stop_BLEscan diff --git a/src/hal/ttgov21.h b/src/hal/ttgov21.h index 6f4d1255..a93a21be 100644 --- a/src/hal/ttgov21.h +++ b/src/hal/ttgov21.h @@ -11,9 +11,9 @@ #define HAS_DISPLAY U8X8_SSD1306_128X64_NONAME_HW_I2C #define DISPLAY_FLIP 1 // rotated display -#define HAS_LED GPIO_NUM_23 // green on board LED (new board ONLY) -#define HAS_BATTERY_PROBE ADC1_GPIO35_CHANNEL // uses GPIO7 (new board ONLY) -#define BATT_FACTOR 2 // voltage divider 100k/100k on board (new board ONLY) +#define HAS_LED GPIO_NUM_23 // green on board LED (new board ONLY) +#define HAS_BATTERY_PROBE ADC1_GPIO35_CHANNEL // uses GPIO7 +#define BATT_FACTOR 2 // voltage divider 100k/100k on board // re-define pin definitions of pins_arduino.h #define PIN_SPI_SS GPIO_NUM_18 // ESP32 GPIO18 (Pin18) -- HPD13A NSS/SEL (Pin4) SPI Chip Select Input diff --git a/src/macsniff.cpp b/src/macsniff.cpp index fbe0469d..ba9e6824 100644 --- a/src/macsniff.cpp +++ b/src/macsniff.cpp @@ -9,10 +9,9 @@ // Local logging tag static const char TAG[] = "wifi"; -static wifi_country_t wifi_country = {.cc = WIFI_MY_COUNTRY, - .schan = WIFI_CHANNEL_MIN, - .nchan = WIFI_CHANNEL_MAX, - .policy = WIFI_COUNTRY_POLICY_MANUAL}; +static wifi_country_t wifi_country = {WIFI_MY_COUNTRY, WIFI_CHANNEL_MIN, + WIFI_CHANNEL_MAX, 0, + WIFI_COUNTRY_POLICY_MANUAL}; // globals uint16_t salt; @@ -106,7 +105,7 @@ void wifi_sniffer_init(void) { esp_wifi_set_country(&wifi_country)); // set locales for RF and channels ESP_ERROR_CHECK( esp_wifi_set_storage(WIFI_STORAGE_RAM)); // we don't need NVRAM - // ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_NULL)); + ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_NULL)); ESP_ERROR_CHECK( esp_wifi_set_promiscuous_filter(&filter)); // set MAC frame filter ESP_ERROR_CHECK(esp_wifi_set_promiscuous_rx_cb(&wifi_sniffer_packet_handler)); diff --git a/src/main.h b/src/main.h index e807d7a1..0a4b5f91 100644 --- a/src/main.h +++ b/src/main.h @@ -5,7 +5,7 @@ // program version - note: increment version after modifications to configData_t // struct!! -#define PROGVERSION "1.3.82" // use max 10 chars here! +#define PROGVERSION "1.3.83" // use max 10 chars here! #define PROGNAME "PAXCNT" //--- Declarations --- diff --git a/src/paxcounter.conf b/src/paxcounter.conf index 357ed009..632b2544 100644 --- a/src/paxcounter.conf +++ b/src/paxcounter.conf @@ -12,7 +12,6 @@ #define BLECOUNTER 1 // comment out if you don't want BLE count, saves power & memory // BLE scan parameters -#define BLESTACKSIZE 8192 // stack size for esp_bt_controller #define BLESCANTIME 0 // [seconds] scan duration, 0 means infinite [default], see note below #define BLESCANWINDOW 80 // [milliseconds] scan window, see below, 3 .. 10240, default 80ms #define BLESCANINTERVAL 80 // [illiseconds] scan interval, see below, 3 .. 10240, default 80ms = 100% duty cycle @@ -53,7 +52,7 @@ #define RGBLUMINOSITY 30 // 30% // OLED Display refresh cycle (in Milliseconds) -#define DISPLAYREFRESH_MS 40 // e.g. 40ms -> 1000/40 = 25 frames per second +#define DISPLAYREFRESH_MS 80 // e.g. 40ms -> 1000/40 = 25 frames per second // LMIC settings // define hardware independent LMIC settings here, settings of standard library in /lmic/config.h will be ignored