Topic: How to check to see which page is displayed when using the page button
I am using two page buttons. Is there a way to check to see which page is the currently displayed page?
You are not logged in. Please login or register.
RemoteXY community → Need help → How to check to see which page is displayed when using the page button
I am using two page buttons. Is there a way to check to see which page is the currently displayed page?
Currently there is no feedback to the MCU which "page" is being displayed, and it would be a feature that would have profound benefits.
Currently I am embarking on a project where I can envisage, say, 16 buttons on each of, say 10 pages. That will require 160 declared variables, and a huge amount of editing the button configurations.
Much simpler would be to allow the 16 buttons to be on every page, 16 declared variables, and one more variable for a "page number" or page name if need be. 160 down to 17 would be a huge advantage in terms of bandwidth used. We can always use the button states associated with an indicated page to decide in our code what happens.
I fear that the developer either has lost interest, or doesn't have the time to consider various "enhancements" that would make RemoteXY the market leader.
I would also like to see boolean button "groups", allowing for up to 32 buttons to be transmitted in one variable, instead of a byte for each.
There are so many things that could be done ....
Thanks Daba for the reply. I really wish we could check which page is displayed. I was hoping I had just overlooked instructions on how to do it.
I wish there were instructions for all of the available options, but there is no documentation on how to use quite a few of them.
Hopefully we will see these things soon.
Again, thanks for the reply.
I wish there were instructions for all of the available options, but there is no documentation on how to use quite a few of them.
Hopefully we will see these things soon.
I wouldn't hold your breath, responsiveness of RemoteXY is not great at the best of times.
On the Page buttons issue, I would also prefer the page button for the current page to be hidden. There is no point having a button to reload the current page ....
I have a thought about how we can "engineer" a Page Number variable, but it will need testing before I release it..
Ok, so I managed to get something working ...
It uses the fact that overlapping or overlaid objects will all respond, so I simply put my "Page" buttons on top of the segments of a "Selector". Obviously I had to hide as much of the selector as I could.
Tested and it does work, but could probably be improved upon.
It was configured and compiled for a Wemos D1 mini, but could be changed for any supported module.
Here's link to the sample RemoteXY project... https://remotexy.com/en/editor/773b211c … a4cd64748/
and here's the code I used ...
// Demonstration of how to get the currently displayed
// RemoteXY Page into your sketch. Currently this is not
// available from RemoteXY.
//
// It uses a "hidden" Selector which is overlayed with
// the Page buttons.
//
// When a Page button is pressed, it will also set the
// Selector to a value that can be used in your sketch to
// determine what page is being displayed.
//////////////////////////////////////////////
// RemoteXY include library //
//////////////////////////////////////////////
// RemoteXY select connection mode and include library
#define REMOTEXY_MODE__ESP8266WIFI_LIB_POINT
#include <ESP8266WiFi.h>
#include <RemoteXY.h>
// RemoteXY connection settings
#define REMOTEXY_WIFI_SSID "PageNumber"
#define REMOTEXY_WIFI_PASSWORD ""
#define REMOTEXY_SERVER_PORT 6377
// RemoteXY configurate
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] = // 93 bytes
{ 255,3,0,0,0,86,0,16,24,4,3,3,6,13,13,36,0,24,24,131,
1,3,13,18,10,3,2,31,80,103,46,49,0,7,21,76,25,13,9,0,
2,26,2,131,0,3,25,18,10,1,2,31,80,103,46,50,0,131,0,3,
37,18,10,2,2,31,80,103,46,51,0,129,0,41,27,33,5,0,17,67,
117,114,114,114,101,110,116,32,80,97,103,101,0 };
// this structure defines all the variables and events of your control interface
struct {
// input variables
uint8_t select_1; // =0 if select position A, =1 if position B, =2 if position C, ...
int16_t edit_1; // 32767.. +32767
// other variable
uint8_t connect_flag; // =1 if wire connected, else =0
} RemoteXY;
#pragma pack(pop)
/////////////////////////////////////////////
// END RemoteXY include //
/////////////////////////////////////////////
int16_t Page_No; //
void setup() {
RemoteXY_Init();
}
void loop() {
RemoteXY_Handler();
// get the selector position
Page_No = RemoteXY.select_1 + 1; //selector starts at 0
// display the page number (optional)
// if you are going to do this, it should really be a "text"
// object, but it really doesn't matter unless you
// inadvertantly press it.
RemoteXY.edit_1 = Page_No;
// just to simulate your code
delay(100);
}
I am going to give this a try. This may work beautifully for my project as a workaround.
Thank you!
I am going to give this a try. This may work beautifully for my project as a workaround.
Thank you!
You can also use buttons behind the page buttons, but you'd have to write code to see which Page button has been pressed ...
e.g.
if(RemoteXY.Page_Button_1) Page_Number = 0;
if(RemoteXY.Page_Button_2) Page_Number = 1;
if(RemoteXY.Page_Button_3) Page_Number = 2;
if(RemoteXY.button_1) Button_Number = 1;
if(RemoteXY.button_2) Button_Number = 2;
if(RemoteXY.button_3) Button_Number = 3;
if(RemoteXY.button_4) Button_Number = 4;
if(RemoteXY.button_5) Button_Number = 5;
if(RemoteXY.button_6) Button_Number = 6;
if(RemoteXY.button_7) Button_Number = 7;
if(RemoteXY.button_8) Button_Number = 8;
if(RemoteXY.button_9) Button_Number = 9;
if(RemoteXY.button_10) Button_Number = 10;
if(RemoteXY.button_11) Button_Number = 11;
if(RemoteXY.button_12) Button_Number = 12;
if(RemoteXY.button_13) Button_Number = 13;
if(RemoteXY.button_14) Button_Number = 14;
if(RemoteXY.button_15) Button_Number = 15;
RemoteXY.Button_No = (Page_Number * Buttons_Per_Page) + Button_Number;
This gives me 45 buttons, spread across 3 Pages, using only 15 + 3 = 18 buttons. For each set of 15 buttons there is only 1 more button variable needed, so it becomes very efficient for multiple pages.
Remember to reset (to zero) the RemoteXY.Button_No variable after you have actioned each button.
RemoteXY community → Need help → How to check to see which page is displayed when using the page button
Powered by PunBB, supported by Informer Technologies, Inc.