add config options for debug level for each task, default to info

This commit is contained in:
Christopher Liebman 2018-01-28 08:37:57 -08:00
parent 325f748516
commit 6ab4e383a8
6 changed files with 128 additions and 11 deletions

View File

@ -14,4 +14,121 @@ config WPS_TYPE_DISABLE
bool "disable" bool "disable"
endchoice endchoice
choice APP_LOG_LEVEL
prompt "APP Log Level"
default APP_LOG_LEVEL_INFO
help
Logging level for APP main
config APP_LOG_LEVEL_NONE
bool "No output"
config APP_LOG_LEVEL_ERROR
bool "Error"
config APP_LOG_LEVEL_WARN
bool "Warning"
config APP_LOG_LEVEL_INFO
bool "Info"
config APP_LOG_LEVEL_DEBUG
bool "Debug"
config APP_LOG_LEVEL_VERBOSE
bool "Verbose"
endchoice
config APP_LOG_LEVEL
int
default 0 if APP_LOG_LEVEL_NONE
default 1 if APP_LOG_LEVEL_ERROR
default 2 if APP_LOG_LEVEL_WARN
default 3 if APP_LOG_LEVEL_INFO
default 4 if APP_LOG_LEVEL_DEBUG
default 5 if APP_LOG_LEVEL_VERBOSE
choice GPS_LOG_LEVEL
prompt "GPS Log Level"
default GPS_LOG_LEVEL_INFO
help
Logging level for GPS task
config GPS_LOG_LEVEL_NONE
bool "No output"
config GPS_LOG_LEVEL_ERROR
bool "Error"
config GPS_LOG_LEVEL_WARN
bool "Warning"
config GPS_LOG_LEVEL_INFO
bool "Info"
config GPS_LOG_LEVEL_DEBUG
bool "Debug"
config GPS_LOG_LEVEL_VERBOSE
bool "Verbose"
endchoice
config GPS_LOG_LEVEL
int
default 0 if GPS_LOG_LEVEL_NONE
default 1 if GPS_LOG_LEVEL_ERROR
default 2 if GPS_LOG_LEVEL_WARN
default 3 if GPS_LOG_LEVEL_INFO
default 4 if GPS_LOG_LEVEL_DEBUG
default 5 if GPS_LOG_LEVEL_VERBOSE
choice NTP_LOG_LEVEL
prompt "NTP Log Level"
default NTP_LOG_LEVEL_INFO
help
Logging level for NTP task
config NTP_LOG_LEVEL_NONE
bool "No output"
config NTP_LOG_LEVEL_ERROR
bool "Error"
config NTP_LOG_LEVEL_WARN
bool "Warning"
config NTP_LOG_LEVEL_INFO
bool "Info"
config NTP_LOG_LEVEL_DEBUG
bool "Debug"
config NTP_LOG_LEVEL_VERBOSE
bool "Verbose"
endchoice
config NTP_LOG_LEVEL
int
default 0 if NTP_LOG_LEVEL_NONE
default 1 if NTP_LOG_LEVEL_ERROR
default 2 if NTP_LOG_LEVEL_WARN
default 3 if NTP_LOG_LEVEL_INFO
default 4 if NTP_LOG_LEVEL_DEBUG
default 5 if NTP_LOG_LEVEL_VERBOSE
choice DISPLAY_LOG_LEVEL
prompt "DISPLAY Log Level"
default DISPLAY_LOG_LEVEL_INFO
help
Logging level for DISPLAY task
config DISPLAY_LOG_LEVEL_NONE
bool "No output"
config DISPLAY_LOG_LEVEL_ERROR
bool "Error"
config DISPLAY_LOG_LEVEL_WARN
bool "Warning"
config DISPLAY_LOG_LEVEL_INFO
bool "Info"
config DISPLAY_LOG_LEVEL_DEBUG
bool "Debug"
config DISPLAY_LOG_LEVEL_VERBOSE
bool "Verbose"
endchoice
config DISPLAY_LOG_LEVEL
int
default 0 if DISPLAY_LOG_LEVEL_NONE
default 1 if DISPLAY_LOG_LEVEL_ERROR
default 2 if DISPLAY_LOG_LEVEL_WARN
default 3 if DISPLAY_LOG_LEVEL_INFO
default 4 if DISPLAY_LOG_LEVEL_DEBUG
default 5 if DISPLAY_LOG_LEVEL_VERBOSE
endmenu endmenu

View File

@ -125,7 +125,7 @@ static void dsp_task()
void start_display() void start_display()
{ {
esp_log_level_set(TAG, ESP_LOG_INFO); esp_log_level_set(TAG, CONFIG_DISPLAY_LOG_LEVEL);
esp_log_level_set("u8g2_hal", ESP_LOG_INFO); esp_log_level_set("u8g2_hal", ESP_LOG_INFO);
xTaskCreatePinnedToCore(dsp_task, "dsp_task", 1024*4, NULL, DSP_TASK_PRI, NULL, 1); xTaskCreatePinnedToCore(dsp_task, "dsp_task", 1024*4, NULL, DSP_TASK_PRI, NULL, 1);

View File

@ -7,6 +7,7 @@
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"
#define LOG_LOCAL_LEVEL ESP_LOG_VERBOSE // we have separate config choices for all app parts
#include "esp_log.h" #include "esp_log.h"
#ifndef MAIN_ESP_GPS_NTP_H_ #ifndef MAIN_ESP_GPS_NTP_H_

View File

@ -6,18 +6,16 @@
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. CONDITIONS OF ANY KIND, either express or implied.
*/ */
#include "esp_gps_ntp.h"
#include <stdio.h> #include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h" #include "esp_system.h"
#include "esp_wifi.h" #include "esp_wifi.h"
#include "esp_log.h"
#include "esp_wps.h" #include "esp_wps.h"
#include "esp_event_loop.h" #include "esp_event_loop.h"
#include "nvs_flash.h" #include "nvs_flash.h"
#include "esp_gps_ntp.h"
/*set wps mode via "make menuconfig"*/ /*set wps mode via "make menuconfig"*/
#if CONFIG_WPS_TYPE_PBC #if CONFIG_WPS_TYPE_PBC
@ -123,19 +121,20 @@ micros_t IRAM_ATTR micros()
void app_main() void app_main()
{ {
printf("ESP32 GPS NTP Server\n"); esp_log_level_set(TAG, CONFIG_APP_LOG_LEVEL);
ESP_LOGI(TAG, "ESP32 GPS NTP Server");
/* Print chip information */ /* Print chip information */
esp_chip_info_t chip_info; esp_chip_info_t chip_info;
esp_chip_info(&chip_info); esp_chip_info(&chip_info);
printf("This is ESP32 chip with %d CPU cores, WiFi%s%s, ", ESP_LOGI(TAG, "This is ESP32 chip with %d CPU cores, WiFi%s%s, ",
chip_info.cores, chip_info.cores,
(chip_info.features & CHIP_FEATURE_BT) ? "/BT" : "", (chip_info.features & CHIP_FEATURE_BT) ? "/BT" : "",
(chip_info.features & CHIP_FEATURE_BLE) ? "/BLE" : ""); (chip_info.features & CHIP_FEATURE_BLE) ? "/BLE" : "");
printf("silicon revision %d, ", chip_info.revision); ESP_LOGI(TAG, "silicon revision %d, ", chip_info.revision);
printf("\n*****\nRUNNING on core %d\n*****\n", xPortGetCoreID()); ESP_LOGI(TAG, "***** RUNNING on core %d *****", xPortGetCoreID());
fflush(stdout); fflush(stdout);
/* Initialize NVS — it is used to store PHY calibration data */ /* Initialize NVS — it is used to store PHY calibration data */

View File

@ -473,7 +473,7 @@ static void gps_task()
void start_gps() void start_gps()
{ {
esp_log_level_set(TAG, ESP_LOG_INFO); esp_log_level_set(TAG, CONFIG_GPS_LOG_LEVEL);
xTaskCreatePinnedToCore(gps_task, "gps_task", 1024*2, NULL, GPS_TASK_PRI, NULL, 1); xTaskCreatePinnedToCore(gps_task, "gps_task", 1024*2, NULL, GPS_TASK_PRI, NULL, 1);

View File

@ -249,7 +249,7 @@ static void ntp_task()
void start_ntp() void start_ntp()
{ {
esp_log_level_set(TAG, ESP_LOG_INFO); esp_log_level_set(TAG, CONFIG_NTP_LOG_LEVEL);
xTaskCreatePinnedToCore(ntp_task, "ntp_task", 1024*2, NULL, NTP_TASK_PRI, NULL, 1); xTaskCreatePinnedToCore(ntp_task, "ntp_task", 1024*2, NULL, NTP_TASK_PRI, NULL, 1);
} }