sensor init

This commit is contained in:
Klaus K Wilting 2018-11-20 16:48:35 +01:00
parent 1a24689652
commit 12ad60a0a8
5 changed files with 18 additions and 4 deletions

View File

@ -3,5 +3,6 @@
uint8_t sensor_mask(uint8_t sensor_no); uint8_t sensor_mask(uint8_t sensor_no);
uint8_t * sensor_read(uint8_t sensor); uint8_t * sensor_read(uint8_t sensor);
void sensor_init(void);
#endif #endif

View File

@ -32,7 +32,7 @@ description = Paxcounter is a proof-of-concept ESP32 device for metering passeng
release_version = 1.6.83 release_version = 1.6.83
; 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 = 3
; UPLOAD MODE: select esptool to flash via USB/UART, select custom to upload to cloud for OTA ; UPLOAD MODE: select esptool to flash via USB/UART, select custom to upload to cloud for OTA
upload_protocol = esptool upload_protocol = esptool
;upload_protocol = custom ;upload_protocol = custom

View File

@ -317,9 +317,9 @@ void loadConfig() {
if (nvs_get_i8(my_handle, "payloadmask", &flash8) == ESP_OK) { if (nvs_get_i8(my_handle, "payloadmask", &flash8) == ESP_OK) {
cfg.payloadmask = flash8; cfg.payloadmask = flash8;
ESP_LOGI(TAG, "GPS mode = %d", flash8); ESP_LOGI(TAG, "payloadmask = %u", flash8);
} else { } else {
ESP_LOGI(TAG, "GPS mode set to default %d", cfg.payloadmask); ESP_LOGI(TAG, "payloadmask set to default %u", cfg.payloadmask);
saveConfig(); saveConfig();
} }

View File

@ -158,12 +158,18 @@ void setup() {
strcat_P(features, " GPS"); strcat_P(features, " GPS");
#endif #endif
// initialize gps // initialize bme
#ifdef HAS_BME #ifdef HAS_BME
strcat_P(features, " BME"); strcat_P(features, " BME");
bme_init(); bme_init();
#endif #endif
// initialize sensors
#ifdef HAS_SENSORS
strcat_P(features, " SENS");
sensor_init();
#endif
// initialize LoRa // initialize LoRa
#ifdef HAS_LORA #ifdef HAS_LORA
strcat_P(features, " LORA"); strcat_P(features, " LORA");

View File

@ -4,6 +4,13 @@
// Local logging tag // Local logging tag
static const char TAG[] = "main"; static const char TAG[] = "main";
void sensor_init(void) {
// this function is called dureing device startup
// put your sensor initialization routines here
}
uint8_t sensor_mask(uint8_t sensor_no) { uint8_t sensor_mask(uint8_t sensor_no) {
switch (sensor_no) { switch (sensor_no) {
case 1: case 1: