Added screenshot mode config and updated copyright docs (#126)

This commit is contained in:
Ken Van Hoeylandt 2024-12-15 13:16:59 +01:00 committed by GitHub
parent 07f45b8fb0
commit 100c24f6a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 47 additions and 10 deletions

View File

@ -1,3 +1,4 @@
#include "Tactility.h"
#include "hal/Configuration.h" #include "hal/Configuration.h"
#include "hal/SimulatorPower.h" #include "hal/SimulatorPower.h"
#include "LvglTask.h" #include "LvglTask.h"
@ -7,6 +8,8 @@
#define TAG "hardware" #define TAG "hardware"
extern const tt::hal::sdcard::SdCard simulatorSdcard;
static bool initBoot() { static bool initBoot() {
lv_init(); lv_init();
lvgl_task_start(); lvgl_task_start();
@ -28,7 +31,7 @@ extern const tt::hal::Configuration hardware = {
.initBoot = initBoot, .initBoot = initBoot,
.createDisplay = createDisplay, .createDisplay = createDisplay,
.createKeyboard = createKeyboard, .createKeyboard = createKeyboard,
.sdcard = nullptr, .sdcard = &simulatorSdcard,
.power = simulatorPower, .power = simulatorPower,
.i2c = { .i2c = {
tt::hal::i2c::Configuration { tt::hal::i2c::Configuration {

View File

@ -0,0 +1,26 @@
#include "Tactility.h"
#include "hal/sdcard/Sdcard.h"
static uint32_t fake_handle = 0;
static void* _Nullable sdcard_mount(TT_UNUSED const char* mount_point) {
return &fake_handle;
}
static void* sdcard_init_and_mount(TT_UNUSED const char* mount_point) {
return &fake_handle;
}
static void sdcard_unmount(TT_UNUSED void* context) {
}
static bool sdcard_is_mounted(TT_UNUSED void* context) {
return TT_SCREENSHOT_MODE;
}
extern const tt::hal::sdcard::SdCard simulatorSdcard = {
.mount = &sdcard_init_and_mount,
.unmount = &sdcard_unmount,
.is_mounted = &sdcard_is_mounted,
.mount_behaviour = tt::hal::sdcard::MountBehaviourAtBoot
};

View File

@ -1,10 +1,12 @@
## Tactility # Tactility
The Tactility logo copyrights are owned by Ken Van Hoeylandt. The Tactility logo copyrights are owned by Ken Van Hoeylandt.
Firmwares built from [the original repository](https://github.com/ByteWelder/Tactility) can be redistributed with the Tactility logo. Firmwares built from [the original repository](https://github.com/ByteWelder/Tactility) can be redistributed with the Tactility logo.
For other usages, [contact me](https://kenvanhoeylandt.net). For other usages, [contact me](https://kenvanhoeylandt.net).
The Tactility firmware and code are published under [GPL License Version 3](./LICENSE.md). The Tactility project is published under [GPL License Version 3](./LICENSE.md).
The TactilitySDK project is published under an [MIT License](./LICENSE.md).
# Dependencies # Dependencies

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -3,4 +3,5 @@
#include "TactilityHeadlessConfig.h" #include "TactilityHeadlessConfig.h"
#define TT_CONFIG_APPS_LIMIT 32 #define TT_CONFIG_APPS_LIMIT 32
#define TT_CONFIG_FORCE_ONSCREEN_KEYBOARD false #define TT_CONFIG_FORCE_ONSCREEN_KEYBOARD false // for development/debug purposes
#define TT_SCREENSHOT_MODE false // for taking screenshots (e.g. forces SD card presence and Files tree on simulator)

View File

@ -1,7 +1,7 @@
#include "FilesData.h" #include "FilesData.h"
#include "FileUtils.h" #include "FileUtils.h"
#include "StringUtils.h" #include "StringUtils.h"
#include "TactilityCore.h" #include "Tactility.h"
namespace tt::app::files { namespace tt::app::files {
@ -42,19 +42,24 @@ bool data_set_entries_for_path(std::shared_ptr<Data> data, const char* path) {
* ESP32 does not have a root directory, so we have to create it manually. * ESP32 does not have a root directory, so we have to create it manually.
* We'll add the NVS Flash partitions and the binding for the sdcard. * We'll add the NVS Flash partitions and the binding for the sdcard.
*/ */
if (kernel::getPlatform() == kernel::PlatformEsp && strcmp(path, "/") == 0) { #if TT_SCREENSHOT_MODE
bool show_custom_root = true;
#else
bool show_custom_root = (kernel::getPlatform() == kernel::PlatformEsp && strcmp(path, "/") == 0);
#endif
if (show_custom_root) {
int dir_entries_count = 3; int dir_entries_count = 3;
auto** dir_entries = static_cast<dirent**>(malloc(sizeof(struct dirent*) * 3)); auto** dir_entries = (dirent**)malloc(sizeof(struct dirent*) * 3);
dir_entries[0] = static_cast<dirent*>(malloc(sizeof(struct dirent))); dir_entries[0] = (dirent*)malloc(sizeof(struct dirent));
dir_entries[0]->d_type = TT_DT_DIR; dir_entries[0]->d_type = TT_DT_DIR;
strcpy(dir_entries[0]->d_name, "assets"); strcpy(dir_entries[0]->d_name, "assets");
dir_entries[1] = static_cast<dirent*>(malloc(sizeof(struct dirent))); dir_entries[1] = (dirent*)malloc(sizeof(struct dirent));
dir_entries[1]->d_type = TT_DT_DIR; dir_entries[1]->d_type = TT_DT_DIR;
strcpy(dir_entries[1]->d_name, "config"); strcpy(dir_entries[1]->d_name, "config");
dir_entries[2] = static_cast<dirent*>(malloc(sizeof(struct dirent))); dir_entries[2] = (dirent*)malloc(sizeof(struct dirent));
dir_entries[2]->d_type = TT_DT_DIR; dir_entries[2]->d_type = TT_DT_DIR;
strcpy(dir_entries[2]->d_name, "sdcard"); strcpy(dir_entries[2]->d_name, "sdcard");