remove wifi code from hardwareRevX
This commit is contained in:
parent
b3aa617a59
commit
bbcb6368d0
2 changed files with 0 additions and 60 deletions
|
@ -81,7 +81,6 @@ void HardwareRevX::init() {
|
||||||
setupTFT();
|
setupTFT();
|
||||||
setupTouchScreen();
|
setupTouchScreen();
|
||||||
initLVGL();
|
initLVGL();
|
||||||
setupWifi();
|
|
||||||
setupIMU();
|
setupIMU();
|
||||||
setupIR();
|
setupIR();
|
||||||
|
|
||||||
|
@ -92,18 +91,6 @@ void HardwareRevX::debugPrint(std::string aDebugMessage) {
|
||||||
Serial.print(aDebugMessage.c_str());
|
Serial.print(aDebugMessage.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// void HardwareRevX::MQTTPublish(const char *topic, const char *payload) {
|
|
||||||
// #ifdef ENABLE_WIFI
|
|
||||||
// if (client.connected()) {
|
|
||||||
// client.publish(topic, payload);
|
|
||||||
// } else {
|
|
||||||
// debugPrint("MQTT Client Not Connected When Attempting Publish.");
|
|
||||||
// }
|
|
||||||
// #else
|
|
||||||
// debugPrint("Attempting To Publish MQTT with wifi Disabled!");
|
|
||||||
// #endif
|
|
||||||
// }
|
|
||||||
|
|
||||||
std::shared_ptr<HardwareRevX> HardwareRevX::getInstance(){
|
std::shared_ptr<HardwareRevX> HardwareRevX::getInstance(){
|
||||||
if (!mInstance) {
|
if (!mInstance) {
|
||||||
mInstance = std::shared_ptr<HardwareRevX>(new HardwareRevX());
|
mInstance = std::shared_ptr<HardwareRevX>(new HardwareRevX());
|
||||||
|
@ -218,12 +205,6 @@ void HardwareRevX::enterSleep() {
|
||||||
IMU.readRegister(&intDataRead,
|
IMU.readRegister(&intDataRead,
|
||||||
LIS3DH_INT1_SRC); // really clear interrupt
|
LIS3DH_INT1_SRC); // really clear interrupt
|
||||||
|
|
||||||
#ifdef ENABLE_WIFI
|
|
||||||
// Power down modem
|
|
||||||
WiFi.disconnect();
|
|
||||||
WiFi.mode(WIFI_OFF);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Prepare IO states
|
// Prepare IO states
|
||||||
digitalWrite(LCD_DC, LOW); // LCD control signals off
|
digitalWrite(LCD_DC, LOW); // LCD control signals off
|
||||||
digitalWrite(LCD_CS, LOW);
|
digitalWrite(LCD_CS, LOW);
|
||||||
|
@ -391,25 +372,6 @@ void HardwareRevX::slowDisplayWakeup() {
|
||||||
delay(100); // Wait for the LCD driver to power on
|
delay(100); // Wait for the LCD driver to power on
|
||||||
}
|
}
|
||||||
|
|
||||||
void HardwareRevX::handleWifiEvent(WiFiEvent_t event) {
|
|
||||||
#ifdef ENABLE_WIFI
|
|
||||||
// Serial.printf("[WiFi-event] event: %d\n", event);
|
|
||||||
if (event == ARDUINO_EVENT_WIFI_STA_GOT_IP) {
|
|
||||||
client.setServer(MQTT_SERVER, 1883); // MQTT initialization
|
|
||||||
client.connect("OMOTE"); // Connect using a client id
|
|
||||||
}
|
|
||||||
// Set status bar icon based on WiFi status
|
|
||||||
// TODO allow UI to register a Handler for these events
|
|
||||||
|
|
||||||
// if (event == ARDUINO_EVENT_WIFI_STA_GOT_IP ||
|
|
||||||
// event == ARDUINO_EVENT_WIFI_STA_GOT_IP6) {
|
|
||||||
// lv_label_set_text(WifiLabel, LV_SYMBOL_WIFI);
|
|
||||||
// } else {
|
|
||||||
// lv_label_set_text(WifiLabel, "");
|
|
||||||
// }
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void HardwareRevX::setupIR() {
|
void HardwareRevX::setupIR() {
|
||||||
// Setup IR
|
// Setup IR
|
||||||
IrSender.begin();
|
IrSender.begin();
|
||||||
|
@ -417,16 +379,6 @@ void HardwareRevX::setupIR() {
|
||||||
IrReceiver.enableIRIn(); // Start the receiver
|
IrReceiver.enableIRIn(); // Start the receiver
|
||||||
}
|
}
|
||||||
|
|
||||||
void HardwareRevX::setupWifi() {
|
|
||||||
#ifdef ENABLE_WIFI
|
|
||||||
// Setup WiFi
|
|
||||||
WiFi.setHostname("OMOTE"); // define hostname
|
|
||||||
WiFi.onEvent(wiFiEventImpl);
|
|
||||||
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
|
|
||||||
WiFi.setSleep(true);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void HardwareRevX::startTasks() {
|
void HardwareRevX::startTasks() {
|
||||||
if (xTaskCreate(&HardwareRevX::updateBatteryTask, "Battery Percent Update",
|
if (xTaskCreate(&HardwareRevX::updateBatteryTask, "Battery Percent Update",
|
||||||
1024, nullptr, 5, &batteryUpdateTskHndl) != pdPASS) {
|
1024, nullptr, 5, &batteryUpdateTskHndl) != pdPASS) {
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
#include "SparkFunLIS3DH.h"
|
#include "SparkFunLIS3DH.h"
|
||||||
|
|
||||||
#include "HardwareAbstract.hpp"
|
#include "HardwareAbstract.hpp"
|
||||||
#include <WiFi.h>
|
|
||||||
#include "Wire.h"
|
#include "Wire.h"
|
||||||
#include "lvgl.h"
|
#include "lvgl.h"
|
||||||
#include "battery.hpp"
|
#include "battery.hpp"
|
||||||
|
@ -45,7 +44,6 @@ protected:
|
||||||
void initLVGL();
|
void initLVGL();
|
||||||
void setupIMU();
|
void setupIMU();
|
||||||
void setupIR();
|
void setupIR();
|
||||||
void setupWifi();
|
|
||||||
|
|
||||||
void activityDetection();
|
void activityDetection();
|
||||||
void enterSleep();
|
void enterSleep();
|
||||||
|
@ -56,8 +54,6 @@ protected:
|
||||||
lv_color_t *color_p);
|
lv_color_t *color_p);
|
||||||
void handleTouchPadRead(lv_indev_drv_t *indev_driver, lv_indev_data_t *data);
|
void handleTouchPadRead(lv_indev_drv_t *indev_driver, lv_indev_data_t *data);
|
||||||
|
|
||||||
void handleWifiEvent(WiFiEvent_t event);
|
|
||||||
|
|
||||||
// Tasks
|
// Tasks
|
||||||
void startTasks();
|
void startTasks();
|
||||||
/// @brief Send Battery Notification every 5 Seconds
|
/// @brief Send Battery Notification every 5 Seconds
|
||||||
|
@ -69,9 +65,6 @@ private:
|
||||||
HardwareRevX();
|
HardwareRevX();
|
||||||
|
|
||||||
// Static Wrappers Needed to Satisfy C APIs
|
// Static Wrappers Needed to Satisfy C APIs
|
||||||
static void wiFiEventImpl(WiFiEvent_t event) {
|
|
||||||
mInstance->handleWifiEvent(event);
|
|
||||||
}
|
|
||||||
static void displayFlushImpl(lv_disp_drv_t *disp, const lv_area_t *area,
|
static void displayFlushImpl(lv_disp_drv_t *disp, const lv_area_t *area,
|
||||||
lv_color_t *color_p) {
|
lv_color_t *color_p) {
|
||||||
mInstance->handleDisplayFlush(disp, area, color_p);
|
mInstance->handleDisplayFlush(disp, area, color_p);
|
||||||
|
@ -81,11 +74,6 @@ private:
|
||||||
mInstance->handleTouchPadRead(indev_driver, data);
|
mInstance->handleTouchPadRead(indev_driver, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_WIFI
|
|
||||||
WiFiClient espClient;
|
|
||||||
PubSubClient client = PubSubClient(espClient);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Adafruit_FT6206 touch = Adafruit_FT6206();
|
Adafruit_FT6206 touch = Adafruit_FT6206();
|
||||||
TS_Point touchPoint;
|
TS_Point touchPoint;
|
||||||
TS_Point oldPoint;
|
TS_Point oldPoint;
|
||||||
|
|
Loading…
Add table
Reference in a new issue