mirror of
https://github.com/EyeTrackVR/OpenIris.git
synced 2025-11-04 15:39:42 +08:00
feat: add rudimentary impl for usb tracker in main
This commit is contained in:
parent
35f48f87b1
commit
2934c36d8c
@ -1,13 +1,22 @@
|
|||||||
|
#include <etvr_system.hpp>
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
#include <data/config/project_config.hpp>
|
||||||
#include <io/LEDManager/LEDManager.hpp>
|
#include <io/LEDManager/LEDManager.hpp>
|
||||||
#include <io/camera/cameraHandler.hpp>
|
#include <io/camera/cameraHandler.hpp>
|
||||||
|
#include <logo/logo.hpp>
|
||||||
|
|
||||||
|
#ifdef ETVR_EYE_TRACKER_WEB_API
|
||||||
#include <network/api/webserverHandler.hpp>
|
#include <network/api/webserverHandler.hpp>
|
||||||
#include <network/mDNS/MDNSManager.hpp>
|
#include <network/mDNS/MDNSManager.hpp>
|
||||||
#include <network/stream/streamServer.hpp>
|
#include <network/stream/streamServer.hpp>
|
||||||
#include <network/wifihandler/wifihandler.hpp>
|
#include <network/wifihandler/wifihandler.hpp>
|
||||||
|
#endif // ETVR_EYE_TRACKER_WEB_API
|
||||||
|
|
||||||
#include <data/config/project_config.hpp>
|
#ifdef ETVR_EYE_TRACKER_USB_API
|
||||||
#include <logo/logo.hpp>
|
#include <usb/etvr_eye_tracker_usb.hpp>
|
||||||
|
#endif // ETVR_EYE_TRACKER_USB_API
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ProjectConfig object
|
* @brief ProjectConfig object
|
||||||
@ -22,35 +31,18 @@ LEDManager ledManager(33);
|
|||||||
#ifndef SIM_ENABLED
|
#ifndef SIM_ENABLED
|
||||||
CameraHandler cameraHandler(deviceConfig);
|
CameraHandler cameraHandler(deviceConfig);
|
||||||
#endif // SIM_ENABLED
|
#endif // SIM_ENABLED
|
||||||
|
|
||||||
|
#ifdef ETVR_EYE_TRACKER_WEB_API
|
||||||
WiFiHandler wifiHandler(deviceConfig, WIFI_SSID, WIFI_PASSWORD, WIFI_CHANNEL);
|
WiFiHandler wifiHandler(deviceConfig, WIFI_SSID, WIFI_PASSWORD, WIFI_CHANNEL);
|
||||||
|
|
||||||
// ImprovHandler improvHandler(deviceConfig);
|
|
||||||
|
|
||||||
#ifndef SIM_ENABLED
|
|
||||||
APIServer apiServer(deviceConfig, cameraHandler, "/control");
|
|
||||||
#else
|
|
||||||
APIServer apiServer(deviceConfig, wifiStateManager, "/control");
|
|
||||||
#endif // SIM_ENABLED
|
|
||||||
|
|
||||||
MDNSHandler mdnsHandler(deviceConfig);
|
MDNSHandler mdnsHandler(deviceConfig);
|
||||||
|
#ifdef SIM_ENABLED
|
||||||
#ifndef SIM_ENABLED
|
APIServer apiServer(deviceConfig, wifiStateManager, "/control");
|
||||||
|
#else
|
||||||
|
APIServer apiServer(deviceConfig, cameraHandler, "/control");
|
||||||
StreamServer streamServer;
|
StreamServer streamServer;
|
||||||
#endif // SIM_ENABLED
|
#endif // SIM_ENABLED
|
||||||
|
|
||||||
void setup() {
|
void etvr_eye_tracker_web_init() {
|
||||||
setCpuFrequencyMhz(240); // set to 240mhz for performance boost
|
|
||||||
Serial.begin(115200);
|
|
||||||
Logo::printASCII();
|
|
||||||
Serial.flush();
|
|
||||||
ledManager.begin();
|
|
||||||
#ifndef SIM_ENABLED
|
|
||||||
deviceConfig.attach(cameraHandler);
|
|
||||||
#endif // SIM_ENABLED
|
|
||||||
deviceConfig.attach(mdnsHandler);
|
|
||||||
deviceConfig.attach(wifiHandler);
|
|
||||||
deviceConfig.initConfig();
|
|
||||||
deviceConfig.load();
|
|
||||||
wifiHandler._enable_adhoc = ENABLE_ADHOC;
|
wifiHandler._enable_adhoc = ENABLE_ADHOC;
|
||||||
wifiHandler.begin();
|
wifiHandler.begin();
|
||||||
mdnsHandler.startMDNS();
|
mdnsHandler.startMDNS();
|
||||||
@ -88,7 +80,39 @@ void setup() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif // ETVR_EYE_TRACKER_WEB_API
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
setCpuFrequencyMhz(240);
|
||||||
|
Serial.begin(115200);
|
||||||
|
Logo::printASCII();
|
||||||
|
Serial.flush();
|
||||||
|
ledManager.begin();
|
||||||
|
|
||||||
|
#ifndef SIM_ENABLED
|
||||||
|
deviceConfig.attach(cameraHandler);
|
||||||
|
#endif // SIM_ENABLED
|
||||||
|
|
||||||
|
#ifdef ETVR_EYE_TRACKER_WEB_API
|
||||||
|
deviceConfig.attach(mdnsHandler);
|
||||||
|
deviceConfig.attach(wifiHandler);
|
||||||
|
#endif // ETVR_EYE_TRACKER_WEB_API
|
||||||
|
|
||||||
|
deviceConfig.initConfig();
|
||||||
|
deviceConfig.load();
|
||||||
|
|
||||||
|
#ifdef ETVR_EYE_TRACKER_WEB_API
|
||||||
|
etvr_eye_tracker_web_init();
|
||||||
|
#endif // ETVR_EYE_TRACKER_WEB_API
|
||||||
|
|
||||||
|
#ifdef ETVR_EYE_TRACKER_USB_API
|
||||||
|
etvr_eye_tracker_usb_init();
|
||||||
|
#endif // ETVR_EYE_TRACKER_USB_API
|
||||||
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
ledManager.handleLED();
|
ledManager.handleLED();
|
||||||
|
#ifdef ETVR_EYE_TRACKER_USB_API
|
||||||
|
etvr_eye_tracker_usb_loop();
|
||||||
|
#endif // ETVR_EYE_TRACKER_USB_API
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user