esp32_marauder.ino 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #include <WiFi.h>
  2. #include <Wire.h>
  3. #include "esp_wifi.h"
  4. #include "esp_wifi_types.h"
  5. #include <stdio.h>
  6. #include "freertos/FreeRTOS.h"
  7. #include "freertos/task.h"
  8. #include "esp_system.h"
  9. #include <Arduino.h>
  10. #include "Display.h"
  11. #include "WiFiScan.h"
  12. #include "MenuFunctions.h"
  13. Display display_obj;
  14. WiFiScan wifi_scan_obj;
  15. MenuFunctions menu_function_obj;
  16. uint32_t currentTime = 0;
  17. /*
  18. void getPresses(void *pvParameter)
  19. {
  20. uint16_t t_x = 0, t_y = 0; // To store the touch coordinates
  21. while (true)
  22. {
  23. boolean pressed = display_obj.tft.getTouch(&t_x, &t_y);
  24. Serial.print("X: ");
  25. Serial.print(t_x);
  26. Serial.print(" Y: ");
  27. Serial.println(t_y);
  28. menu_function_obj.pressed = pressed;
  29. //menu_function_obj.handlePress(pressed, t_x, t_y);
  30. if (pressed)
  31. {
  32. menu_function_obj.x = t_x;
  33. menu_function_obj.y = t_y;
  34. }
  35. delay(1);
  36. }
  37. }*/
  38. void setup()
  39. {
  40. pinMode(FLASH_BUTTON, INPUT);
  41. pinMode(TFT_BL, OUTPUT);
  42. digitalWrite(TFT_BL, LOW);
  43. Serial.begin(115200);
  44. Serial.println("\n\n--------------------------------");
  45. Serial.println(" ESP32 Marauder ");
  46. Serial.println("--------------------------------\n\n");
  47. // Run display setup
  48. display_obj.RunSetup();
  49. // Build menus
  50. menu_function_obj.RunSetup();
  51. //menu_function_obj.displayCurrentMenu();
  52. //xTaskCreate(&getPresses, "getPresses", 2048, NULL, 5, NULL);
  53. // Start a scan mode automatically
  54. // In the real version, just setup wifi
  55. // and wait for user input for scan modes
  56. //wifi_scan_obj.StartScan(WIFI_SCAN_PROBE);
  57. }
  58. void loop()
  59. {
  60. // get the current time
  61. currentTime = millis();
  62. // Update all of our objects
  63. display_obj.main();
  64. wifi_scan_obj.main(currentTime);
  65. //if (wifi_scan_obj.currentScanMode == WIFI_SCAN_OFF)
  66. menu_function_obj.main();
  67. //vTaskDelay(portMAX_DELAY);
  68. delay(1);
  69. }