mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-25 20:26:41 +00:00
Add dispatchPageNext and dispatchPagePrev
This commit is contained in:
parent
dc70ea4e7d
commit
772b33016c
@ -225,15 +225,8 @@ void dispatchCommand(const char * topic, const char * payload)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get or Set a page
|
void dispatchCurrentPage()
|
||||||
void dispatchPage(const char * page)
|
|
||||||
{
|
{
|
||||||
// dispatchPrintln(F("PAGE"), strPageid);
|
|
||||||
|
|
||||||
if(strlen(page) > 0 && atoi(page) <= 250) {
|
|
||||||
haspSetPage(atoi(page));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Log result
|
// Log result
|
||||||
char buffer[4];
|
char buffer[4];
|
||||||
itoa(haspGetPage(), buffer, DEC);
|
itoa(haspGetPage(), buffer, DEC);
|
||||||
@ -247,6 +240,40 @@ void dispatchPage(const char * page)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get or Set a page
|
||||||
|
void dispatchPage(const char * page)
|
||||||
|
{
|
||||||
|
if(strlen(page) > 0 && atoi(page) < HASP_NUM_PAGES) {
|
||||||
|
haspSetPage(atoi(page));
|
||||||
|
}
|
||||||
|
|
||||||
|
dispatchCurrentPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
void dispatchPageNext()
|
||||||
|
{
|
||||||
|
uint8_t page = haspGetPage();
|
||||||
|
if(page + 1 >= HASP_NUM_PAGES) {
|
||||||
|
page = 0;
|
||||||
|
} else {
|
||||||
|
page++;
|
||||||
|
}
|
||||||
|
haspSetPage(page);
|
||||||
|
dispatchCurrentPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
void dispatchPagePrev()
|
||||||
|
{
|
||||||
|
uint8_t page = haspGetPage();
|
||||||
|
if(page == 0) {
|
||||||
|
page = HASP_NUM_PAGES - 1;
|
||||||
|
} else {
|
||||||
|
page--;
|
||||||
|
}
|
||||||
|
haspSetPage(page);
|
||||||
|
dispatchCurrentPage();
|
||||||
|
}
|
||||||
|
|
||||||
// Clears a page id or the current page if empty
|
// Clears a page id or the current page if empty
|
||||||
void dispatchClearPage(const char * page)
|
void dispatchClearPage(const char * page)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user