add duration to custompage

This commit is contained in:
Stephan Mühl
2023-04-01 18:32:20 +02:00
parent 01cf81397f
commit 058e9d1ba8
18 changed files with 234 additions and 425 deletions

View File

@@ -3,6 +3,7 @@
#include <Globals.h>
#include <ServerManager.h>
#include <DisplayManager.h>
#include <PeripheryManager.h>
#include <updater.h>
#include <icons.h>
@@ -26,7 +27,8 @@ enum MenuState
WeekdayMenu,
TempMenu,
Appmenu,
SoundMenu
SoundMenu,
VolumeMenu
};
const char *menuItems[] PROGMEM = {
@@ -42,10 +44,11 @@ const char *menuItems[] PROGMEM = {
"TEMP",
"APPS",
"SOUND",
"VOLUME",
"UPDATE"};
int8_t menuIndex = 0;
uint8_t menuItemCount = 13;
uint8_t menuItemCount = 14;
const char *timeFormat[] PROGMEM = {
"%H:%M:%S",
@@ -77,10 +80,10 @@ const char *appsItems[][2] PROGMEM = {
{"13", "time"},
{"1158", "date"},
{"234", "temp"},
#ifdef ULANZI
#ifdef ULANZI
{"2075", "hum"},
{"1486", "bat"}};
#else
#else
{"2075", "hum"}};
#endif
@@ -247,6 +250,10 @@ void MenuManager_::rightButton()
case TempMenu:
IS_CELSIUS = !IS_CELSIUS;
break;
case VolumeMenu:
VOLUME_PERCENT = (VOLUME_PERCENT % 100) + 1;
VOLUME = map(VOLUME_PERCENT, 0, 100, 0, 30);
PeripheryManager.setVolume(VOLUME);
default:
break;
}
@@ -307,6 +314,10 @@ void MenuManager_::leftButton()
case SoundMenu:
SOUND_ACTIVE = !SOUND_ACTIVE;
break;
case VolumeMenu:
VOLUME_PERCENT = (VOLUME_PERCENT % 100) + 1;
VOLUME = map(VOLUME_PERCENT, 0, 100, 0, 30);
PeripheryManager.setVolume(VOLUME);
default:
break;
}
@@ -361,6 +372,11 @@ void MenuManager_::selectButton()
currentState = SoundMenu;
break;
case 12:
#ifdef AWTRIX_UPGRADE
currentState = VolumeMenu;
#endif
break;
case 13:
if (FirmwareVersionCheck())
{
updateFirmware();
@@ -437,6 +453,12 @@ void MenuManager_::selectButtonLong()
DisplayManager.applyAllSettings();
saveSettings();
break;
case VolumeMenu:
#ifdef AWTRIX_UPGRADE
VOLUME = map(VOLUME_PERCENT, 0, 100, 0, 30);
saveSettings();
#endif
break;
case TimeFormatMenu:
TIME_FORMAT = timeFormat[timeFormatIndex];
saveSettings();