## Summary * **What is the goal of this PR?** (e.g., Fixes a bug in the user authentication module, Implements the new feature for file uploading.) As we get more settings, I think it makes sense to do categories for them. This just allows users to find the settings easier and navigate to them. * **What changes are included?** ## Additional Context * Add any other information that might be helpful for the reviewer (e.g., performance implications, potential risks, specific areas to focus on). Co-authored-by: dpoulter <daniel@yoco.com> Co-authored-by: Dave Allie <dave@daveallie.com>
38 lines
1.1 KiB
C++
38 lines
1.1 KiB
C++
#pragma once
|
|
#include <freertos/FreeRTOS.h>
|
|
#include <freertos/semphr.h>
|
|
#include <freertos/task.h>
|
|
|
|
#include <functional>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "activities/ActivityWithSubactivity.h"
|
|
|
|
class CrossPointSettings;
|
|
struct SettingInfo;
|
|
|
|
class SettingsActivity final : public ActivityWithSubactivity {
|
|
TaskHandle_t displayTaskHandle = nullptr;
|
|
SemaphoreHandle_t renderingMutex = nullptr;
|
|
bool updateRequired = false;
|
|
int selectedCategoryIndex = 0; // Currently selected category
|
|
const std::function<void()> onGoHome;
|
|
|
|
static constexpr int categoryCount = 4;
|
|
static const char* categoryNames[categoryCount];
|
|
|
|
static void taskTrampoline(void* param);
|
|
[[noreturn]] void displayTaskLoop();
|
|
void render() const;
|
|
void enterCategory(int categoryIndex);
|
|
|
|
public:
|
|
explicit SettingsActivity(GfxRenderer& renderer, MappedInputManager& mappedInput,
|
|
const std::function<void()>& onGoHome)
|
|
: ActivityWithSubactivity("Settings", renderer, mappedInput), onGoHome(onGoHome) {}
|
|
void onEnter() override;
|
|
void onExit() override;
|
|
void loop() override;
|
|
};
|