mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-23 03:06:42 +00:00
Only enable SDL2 driver with USE_MONITOR
This commit is contained in:
parent
a7b558eb33
commit
246f5e3ac2
@ -371,7 +371,9 @@ static WiFiSpiClass WiFi;
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#if USE_MONITOR
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define snprintf_P snprintf
|
#define snprintf_P snprintf
|
||||||
#define memcpy_P memcpy
|
#define memcpy_P memcpy
|
||||||
@ -380,7 +382,9 @@ static WiFiSpiClass WiFi;
|
|||||||
#define strcpy_P strcpy
|
#define strcpy_P strcpy
|
||||||
#define strstr_P strstr
|
#define strstr_P strstr
|
||||||
#define halRestartMcu()
|
#define halRestartMcu()
|
||||||
|
#if USE_MONITOR
|
||||||
#define millis SDL_GetTicks
|
#define millis SDL_GetTicks
|
||||||
|
#endif
|
||||||
|
|
||||||
#define DEC 10
|
#define DEC 10
|
||||||
#define HEX 16
|
#define HEX 16
|
||||||
|
@ -11,7 +11,9 @@
|
|||||||
#include "hasp_conf.h"
|
#include "hasp_conf.h"
|
||||||
#include "hasp_debug.h"
|
#include "hasp_debug.h"
|
||||||
|
|
||||||
|
#if USE_MONITOR
|
||||||
#include "display/monitor.h"
|
#include "display/monitor.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace dev {
|
namespace dev {
|
||||||
|
|
||||||
@ -48,8 +50,10 @@ const char* Win32Device::get_hostname()
|
|||||||
void Win32Device::set_hostname(const char* hostname)
|
void Win32Device::set_hostname(const char* hostname)
|
||||||
{
|
{
|
||||||
_hostname = hostname;
|
_hostname = hostname;
|
||||||
|
#if USE_MONITOR
|
||||||
monitor_title(hostname);
|
monitor_title(hostname);
|
||||||
// SDL_SetWindowTitle(monitor.window, hostname);
|
// SDL_SetWindowTitle(monitor.window, hostname);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
const char* Win32Device::get_core_version()
|
const char* Win32Device::get_core_version()
|
||||||
{
|
{
|
||||||
@ -112,7 +116,9 @@ void Win32Device::update_backlight()
|
|||||||
{
|
{
|
||||||
uint8_t level = _backlight_power ? _backlight_level : 0;
|
uint8_t level = _backlight_power ? _backlight_level : 0;
|
||||||
if(_backlight_invert) level = 255 - level;
|
if(_backlight_invert) level = 255 - level;
|
||||||
|
#if USE_MONITOR
|
||||||
monitor_backlight(level);
|
monitor_backlight(level);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t Win32Device::get_free_max_block()
|
size_t Win32Device::get_free_max_block()
|
||||||
|
@ -77,7 +77,7 @@ class BaseTft {
|
|||||||
#elif defined(STM32F7)
|
#elif defined(STM32F7)
|
||||||
#warning Building for STM32F7xx Tfts
|
#warning Building for STM32F7xx Tfts
|
||||||
#include "tft_driver_tftespi.h"
|
#include "tft_driver_tftespi.h"
|
||||||
#elif defined(WINDOWS) || defined(POSIX)
|
#elif USE_MONITOR && (defined(WINDOWS) || defined(POSIX))
|
||||||
// #warning Building for SDL2
|
// #warning Building for SDL2
|
||||||
#include "tft_driver_sdl2.h"
|
#include "tft_driver_sdl2.h"
|
||||||
#else
|
#else
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* MIT License - Copyright (c) 2019-2022 Francis Van Roie
|
/* MIT License - Copyright (c) 2019-2022 Francis Van Roie
|
||||||
For full license information read the LICENSE file in the project folder */
|
For full license information read the LICENSE file in the project folder */
|
||||||
|
|
||||||
#if defined(WINDOWS) || defined(POSIX)
|
#if USE_MONITOR && (defined(WINDOWS) || defined(POSIX))
|
||||||
|
|
||||||
#include "hasplib.h"
|
#include "hasplib.h"
|
||||||
#include "lvgl.h"
|
#include "lvgl.h"
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#include "tft_driver.h"
|
#include "tft_driver.h"
|
||||||
|
|
||||||
#if defined(WINDOWS) || defined(POSIX)
|
#if USE_MONITOR && (defined(WINDOWS) || defined(POSIX))
|
||||||
// #warning Building H driver TFT SDL2
|
// #warning Building H driver TFT SDL2
|
||||||
|
|
||||||
#include "lvgl.h"
|
#include "lvgl.h"
|
||||||
|
@ -309,7 +309,7 @@ void guiSetup()
|
|||||||
static lv_indev_drv_t indev_drv;
|
static lv_indev_drv_t indev_drv;
|
||||||
lv_indev_drv_init(&indev_drv);
|
lv_indev_drv_init(&indev_drv);
|
||||||
indev_drv.type = LV_INDEV_TYPE_POINTER;
|
indev_drv.type = LV_INDEV_TYPE_POINTER;
|
||||||
#if defined(WINDOWS) || defined(POSIX)
|
#if USE_MONITOR && (defined(WINDOWS) || defined(POSIX))
|
||||||
indev_drv.read_cb = mouse_read;
|
indev_drv.read_cb = mouse_read;
|
||||||
#else
|
#else
|
||||||
indev_drv.read_cb = gui_touch_read;
|
indev_drv.read_cb = gui_touch_read;
|
||||||
|
@ -25,7 +25,9 @@
|
|||||||
#include "hasplib.h"
|
#include "hasplib.h"
|
||||||
|
|
||||||
// #include "app_hal.h"
|
// #include "app_hal.h"
|
||||||
|
#if USE_MONITOR
|
||||||
#include "display/monitor.h"
|
#include "display/monitor.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "hasp_debug.h"
|
#include "hasp_debug.h"
|
||||||
#include "hasp_gui.h"
|
#include "hasp_gui.h"
|
||||||
@ -258,12 +260,14 @@ int main(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SDL_Init(0); // Needs to be initialized for GetPerfPath
|
|
||||||
char buf[4096]; // never know how much is needed
|
char buf[4096]; // never know how much is needed
|
||||||
std::cout << "CWD: " << cwd(buf, sizeof buf) << std::endl;
|
std::cout << "CWD: " << cwd(buf, sizeof buf) << std::endl;
|
||||||
|
#if USE_MONITOR
|
||||||
|
SDL_Init(0); // Needs to be initialized for GetPerfPath
|
||||||
cd(SDL_GetPrefPath("hasp", "hasp"));
|
cd(SDL_GetPrefPath("hasp", "hasp"));
|
||||||
std::cout << "CWD changed to: " << cwd(buf, sizeof buf) << std::endl;
|
|
||||||
SDL_Quit(); // We'll properly init later
|
SDL_Quit(); // We'll properly init later
|
||||||
|
#endif
|
||||||
|
std::cout << "CWD changed to: " << cwd(buf, sizeof buf) << std::endl;
|
||||||
|
|
||||||
// Change to preferences dir
|
// Change to preferences dir
|
||||||
std::cout << "\nCommand-line arguments:\n";
|
std::cout << "\nCommand-line arguments:\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user