main.c 723 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #include "freertos/FreeRTOS.h"
  2. #include "freertos/task.h"
  3. #include "esp_log.h"
  4. #include "config.h"
  5. #include "wifi.h"
  6. #include "serial.h"
  7. #include "displayAndSend.h"
  8. #include "pcnt_functions.h"
  9. #include "mqtt.h"
  10. // Chip info:
  11. // This is esp32 chip with 2 CPU cores, WiFi/BT/BLE, silicon revision 1, 4MB external flash
  12. void app_main(void)
  13. {
  14. ESP_LOGI("MAIN", "HomeEnergyMeter ESP32. Core:%d",xPortGetCoreID());
  15. #ifdef WIFI_ENABLED
  16. initWifi(); // Init WIFI
  17. #endif
  18. #ifdef MQTT_ENABLED
  19. mqtt_init();
  20. #endif
  21. #ifdef CCFG_PCNT
  22. initPCNT();
  23. #endif
  24. #ifdef CCFG_GEN_PULSE
  25. ledc_init();
  26. #endif
  27. #ifdef SERIAL_ENABLED
  28. initSerial();
  29. #endif
  30. initDisplayAndSend();
  31. vTaskDelete(NULL);
  32. }