compile feature list enhanced

This commit is contained in:
Klaus K Wilting 2018-06-17 11:40:52 +02:00
parent 013222ed73
commit ce43bfd139

View File

@ -468,6 +468,7 @@ void led_loop() {
* ------------------------------------------------------------ */ * ------------------------------------------------------------ */
void setup() { void setup() {
char features[64] = ""; char features[64] = "";
// disable brownout detection // disable brownout detection
@ -517,24 +518,24 @@ void setup() {
// initialize led if needed // initialize led if needed
#if (HAS_LED != NOT_A_PIN) #if (HAS_LED != NOT_A_PIN)
pinMode(HAS_LED, OUTPUT); pinMode(HAS_LED, OUTPUT);
strcat(features, " LED"); strcat_P(features, " LED");
#endif #endif
#ifdef HAS_RGB_LED #ifdef HAS_RGB_LED
rgb_set_color(COLOR_PINK); rgb_set_color(COLOR_PINK);
strcat(features, " RGB"); strcat_P(features, " RGB");
#endif #endif
// initialize button handling if needed // initialize button handling if needed
#ifdef HAS_BUTTON #ifdef HAS_BUTTON
strcat(features, " BTN_"); strcat_P(features, " BTN_");
#ifdef BUTTON_PULLUP #ifdef BUTTON_PULLUP
strcat(features, "PU"); strcat_P(features, "PU");
// install button interrupt (pullup mode) // install button interrupt (pullup mode)
pinMode(HAS_BUTTON, INPUT_PULLUP); pinMode(HAS_BUTTON, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(HAS_BUTTON), ButtonIRQ, RISING); attachInterrupt(digitalPinToInterrupt(HAS_BUTTON), ButtonIRQ, RISING);
#else #else
strcat(features, "PD"); strcat_P(features, "PD");
// install button interrupt (pulldown mode) // install button interrupt (pulldown mode)
pinMode(HAS_BUTTON, INPUT_PULLDOWN); pinMode(HAS_BUTTON, INPUT_PULLDOWN);
attachInterrupt(digitalPinToInterrupt(HAS_BUTTON), ButtonIRQ, FALLING); attachInterrupt(digitalPinToInterrupt(HAS_BUTTON), ButtonIRQ, FALLING);
@ -543,17 +544,17 @@ void setup() {
// initialize wifi antenna if needed // initialize wifi antenna if needed
#ifdef HAS_ANTENNA_SWITCH #ifdef HAS_ANTENNA_SWITCH
strcat(features, " ANT"); strcat_P(features, " ANT");
antenna_init(); antenna_init();
#endif #endif
// initialize gps if present // initialize gps if present
#ifdef HAS_GPS #ifdef HAS_GPS
strcat(features, " GPS"); strcat_P(features, " GPS");
#endif #endif
#ifdef HAS_DISPLAY #ifdef HAS_DISPLAY
strcat(features, " OLED"); strcat_P(features, " OLED");
// initialize display // initialize display
init_display(PROGNAME, PROGVERSION); init_display(PROGNAME, PROGVERSION);
DisplayState = cfg.screenon; DisplayState = cfg.screenon;
@ -589,8 +590,17 @@ void setup() {
timerAlarmWrite(channelSwitch, cfg.wifichancycle * 10000, true); timerAlarmWrite(channelSwitch, cfg.wifichancycle * 10000, true);
timerAlarmEnable(channelSwitch); timerAlarmEnable(channelSwitch);
// show payload encoder
#if PAYLOAD_ENCODER == 1
strcat_P(features, " PAYLOAD_PLAIN");
#elif PAYLOAD_ENCODER == 2
strcat_P(features, " PAYLOAD_SERIALIZED");
#elif PAYLOAD_ENCODER == 3
strcat_P(features, " PAYLOAD_CAYENNE");
#endif
// show compiled features // show compiled features
ESP_LOGI(TAG, "Features %s", features); ESP_LOGI(TAG, "Features: %s", features);
// output LoRaWAN keys to console // output LoRaWAN keys to console
#ifdef VERBOSE #ifdef VERBOSE
@ -630,8 +640,7 @@ void setup() {
} }
#endif #endif
// if device has GPS and GPS function is enabled, start GPS reader task on core // if device has GPS and it is enabled, start GPS reader task on core 0
// 0
#ifdef HAS_GPS #ifdef HAS_GPS
if (cfg.gpsmode) { if (cfg.gpsmode) {
ESP_LOGI(TAG, "Starting GPS task on core 0"); ESP_LOGI(TAG, "Starting GPS task on core 0");
@ -639,8 +648,7 @@ void setup() {
} }
#endif #endif
// kickoff sendjob -> joins network and rescedules sendjob for cyclic // joins network and rescedules sendjob for cyclic transmitting payload
// transmitting payload
do_send(&sendjob); do_send(&sendjob);
} }