From c61b4d1d531eb39a9f1fe5ac4411023d0b9edf9d Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Sun, 3 Jun 2018 13:23:03 +0200 Subject: [PATCH] testing --- platformio.ini | 15 ++++++++++++--- src/adcread.cpp | 8 ++++++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/platformio.ini b/platformio.ini index a08d4c75..72a8988d 100644 --- a/platformio.ini +++ b/platformio.ini @@ -11,10 +11,10 @@ ; ---> SELECT TARGET PLATFORM HERE! <--- [platformio] -env_default = heltec +;env_default = heltec ;env_default = ttgov1 ;env_default = ttgov2 -;env_default = ttgov21 +env_default = ttgov21 ;env_default = lopy ;env_default = lopy4 ;env_default = fipy @@ -27,7 +27,6 @@ description = Paxcounter is a proof-of-concept ESP32 device for metering passeng platform_espressif32 = espressif32@>=1.0.1 board_build.partitions = no_ota.csv board_upload.maximum_size = 2097152 -monitor_speed = 115200 lib_deps_display = U8g2@>=2.22.14 lib_deps_rgbled = @@ -52,6 +51,8 @@ framework = arduino board = heltec_wifi_lora_32 board_build.partitions = ${common_env_data.board_build.partitions} board_upload.maximum_size = ${common_env_data.board_upload.maximum_size} +monitor_speed = 115200 +upload_speed = 115200 lib_deps = ${common_env_data.lib_deps_display} build_flags = @@ -64,6 +65,7 @@ framework = arduino board = esp32dev board_build.partitions = ${common_env_data.board_build.partitions} board_upload.maximum_size = ${common_env_data.board_upload.maximum_size} +monitor_speed = 115200 upload_speed = 115200 lib_deps = ${common_env_data.lib_deps_display} @@ -77,6 +79,7 @@ framework = arduino board = esp32dev board_build.partitions = ${common_env_data.board_build.partitions} board_upload.maximum_size = ${common_env_data.board_upload.maximum_size} +monitor_speed = 115200 upload_speed = 921600 lib_deps = ${common_env_data.lib_deps_display} @@ -90,6 +93,7 @@ framework = arduino board = esp32dev board_build.partitions = ${common_env_data.board_build.partitions} board_upload.maximum_size = ${common_env_data.board_upload.maximum_size} +monitor_speed = 115200 upload_speed = 921600 lib_deps = ${common_env_data.lib_deps_display} @@ -103,6 +107,7 @@ framework = arduino board = esp32dev board_build.partitions = ${common_env_data.board_build.partitions} board_upload.maximum_size = ${common_env_data.board_upload.maximum_size} +monitor_speed = 115200 upload_speed = 921600 lib_deps = ${common_env_data.lib_deps_rgbled} @@ -116,6 +121,7 @@ framework = arduino board = esp32dev board_build.partitions = ${common_env_data.board_build.partitions} board_upload.maximum_size = ${common_env_data.board_upload.maximum_size} +monitor_speed = 115200 upload_speed = 921600 lib_deps = ${common_env_data.lib_deps_rgbled} @@ -129,6 +135,7 @@ framework = arduino board = esp32dev board_build.partitions = ${common_env_data.board_build.partitions} board_upload.maximum_size = ${common_env_data.board_upload.maximum_size} +monitor_speed = 115200 upload_speed = 921600 lib_deps = ${common_env_data.lib_deps_rgbled} @@ -142,6 +149,7 @@ framework = arduino board = lolin32 board_build.partitions = ${common_env_data.board_build.partitions} board_upload.maximum_size = ${common_env_data.board_upload.maximum_size} +monitor_speed = 115200 upload_speed = 256000 lib_deps = ${common_env_data.lib_deps_rgbled} @@ -155,6 +163,7 @@ framework = arduino board = lolin32 board_build.partitions = ${common_env_data.board_build.partitions} board_upload.maximum_size = ${common_env_data.board_upload.maximum_size} +monitor_speed = 115200 upload_speed = 921600 lib_deps = ${common_env_data.lib_deps_rgbled} diff --git a/src/adcread.cpp b/src/adcread.cpp index 2d3572bc..d7300667 100644 --- a/src/adcread.cpp +++ b/src/adcread.cpp @@ -55,9 +55,13 @@ uint16_t read_voltage(void) //Check if Two Point or Vref are burned into eFuse check_efuse(); + //Configure GPIO used fpr ADC1 + gpio_set_direction(GPIO_NUM_35, GPIO_MODE_INPUT); + //Configure ADC1 - adc1_config_width(ADC_WIDTH_BIT_12); - adc1_config_channel_atten(channel, atten); + ESP_ERROR_CHECK(adc_gpio_init(unit, (adc_channel_t) channel)); + ESP_ERROR_CHECK(adc1_config_width(ADC_WIDTH_BIT_12)); + ESP_ERROR_CHECK(adc1_config_channel_atten(channel, atten)); //Characterize ADC1 esp_adc_cal_characteristics_t *adc_chars = (esp_adc_cal_characteristics_t *) calloc(1, sizeof(esp_adc_cal_characteristics_t));