rzeldent / esp32-flightradar24-ttgo

Display real-time flights in an area using the ESP32 TTGO-Display module
44 stars 4 forks source link

Button support #32

Closed eried closed 2 years ago

eried commented 2 years ago

Hi, I am making some changes (button support, sleep) but I was wondering if you ever finished the button routines. Because I replaced all the delays but is still a bit unresponsive while updating the flights (I guess some locking functions).

Upper button sleeps and wakes the device (uses 0.3mAh! while sleeping). Lower button skips to next flight in my unit.

I want to use the lower button to display details about the plane if user holds it.

IMG_20220610_141804

IMG_20220610_141813

IMG_20220610_165336~2

rzeldent commented 2 years ago

Hi Erwin,

Nice to see that the code is being used! We live near an airport and it is amazing to see all the flights that are passing over! Makes you dream to go over to all these destinations...

Also a nice enclosure for the TTGO! 3D printed and will make it much more practical to use it as a finished product. Mine is just lying around :-) And indeed, I haven't added any code for the buttons. My aim was to have something like a "clock" without any user interaction. There is indeed more information available than is being displayed but there is not enough space on the display. The lower button to show a page for the plane details is indeed possible. Your improvements by using the buttons is a great idea and, if you want, please make a pull request for it so it can be incorporated in the main branch. I'll be happy to review it and merge it!

Kind regards,

Rene

On Fri, Jun 10, 2022 at 11:08 PM Erwin Ried @.***> wrote:

Hi, I am making some changes (button support, sleep) but I was wondering if you ever finished the button routines. Because I replaced all the delays but is still a bit unresponsive while updating the flights (I guess some locking functions).

Upper button sleeps and wakes the device (uses 0.3mAh! while sleeping). Lower button skips to next flight in my unit.

I want to use the lower button to display details about the plane if user holds it.

[image: IMG_20220610_141804] https://user-images.githubusercontent.com/1091420/173150916-90e18d91-cafd-4700-98a7-1097cfa239a8.jpg

[image: IMG_20220610_141813] https://user-images.githubusercontent.com/1091420/173150822-e82fb226-cc60-438b-b317-d271769cf18a.jpg

[image: IMG_20220610_165336~2] https://user-images.githubusercontent.com/1091420/173151158-27d880ce-1592-4edc-b907-eefde2daa886.jpg

— Reply to this email directly, view it on GitHub https://github.com/rzeldent/esp32-flightradar24-ttgo/issues/32, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB2ENB5OUQ3LOFVIDELN6FDVOOVFFANCNFSM5YO32AOQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

eried commented 2 years ago

Awesome! the problem is that the code is quite unresponsive :/ so I dont know if is good for a PR. I might try to rewrite some stuff playing with the extra core in the ESP32 to keep things running while the buttons are pressed

rzeldent commented 2 years ago

Hi Erwin,

Please take a look at the other branch. I'm currently working on that one. Please use that as a base to minimize conflicts or wait a few days for it to be merged.

Rene

On Wed, Jun 15, 2022 at 10:27 AM Erwin Ried @.***> wrote:

Awesome! the problem is that the code is quite unresponsive :/ so I dont know if is good for a PR. I might try to rewrite some stuff playing with the extra core in the ESP32 to keep things running while the buttons are pressed

— Reply to this email directly, view it on GitHub https://github.com/rzeldent/esp32-flightradar24-ttgo/issues/32#issuecomment-1156157918, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB2ENBYPDLVRFQNG62CU6YTVPGHV3ANCNFSM5YO32AOQ . You are receiving this because you commented.Message ID: @.***>

eried commented 2 years ago

OK! Cool with the wifi manager :) There is other stuff it would be nice to think about it:

1) multiple boundaries:

2) flight details (maybe a photo of the aircraft)

rzeldent commented 2 years ago

Hi Erwin,

Pull request has been done.

Was thinking about:

But is just for fun and not much time... I'll see!

Regards,

Rene

On Wed, Jun 15, 2022 at 9:52 PM Erwin Ried @.***> wrote:

OK! Cool with the wifi manager :) There is other stuff it would be nice to think about it:

  1. multiple boundaries:

    • Airport
    • What I see from the window
    • etc
  2. flight details (maybe a photo of the aircraft)

— Reply to this email directly, view it on GitHub https://github.com/rzeldent/esp32-flightradar24-ttgo/issues/32#issuecomment-1156862765, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB2ENBYSWSQKZ52QVEYDZXLVPIX7ZANCNFSM5YO32AOQ . You are receiving this because you commented.Message ID: @.***>

eried commented 2 years ago

I understand, but the images could be retrieved directly from jetphotos.com 👍

eried commented 2 years ago

BTW, here is the stand https://www.thingiverse.com/thing:5412296 and I also added some battery measurement before it sleeps (this little ttgo display is quite awesome!) but it would be better to add a permanent battery gauge

rzeldent commented 2 years ago

Hi Erwin,

Yes, Thanks for the link to the stand! Is it okay if I put a link in the README.md?

Take a look at the latest commit. You can add new states. Right now there is only a state called display_flights but this state could be changed by a keypress and show other information... This to accommodate future functionalities!

Rene

On Thu, Jun 16, 2022 at 1:49 PM Erwin Ried @.***> wrote:

BTW, here is the stand https://www.thingiverse.com/thing:5412296 and I also added some battery measurement before it sleeps (this little ttgo display is quite awesome!) but it would be better to add a permanent battery gauge

— Reply to this email directly, view it on GitHub https://github.com/rzeldent/esp32-flightradar24-ttgo/issues/32#issuecomment-1157568279, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB2ENB7MVDVO6CO5KMHHEYDVPMIDRANCNFSM5YO32AOQ . You are receiving this because you commented.Message ID: @.***>

eried commented 2 years ago

Yes, Thanks for the link to the stand! Is it okay if I put a link in the README.md?

yes ofc, I will check the latest code and try to port my changes even as optional (because since the buttons arent very responsive -i.e. while updating the flights they dont work- I dont think it is a very good solution for now)

eried commented 2 years ago

Take a look at the latest commit. You can add new states. Right now there is only a state called display_flights but this state could be changed by a keypress and show other information...

Hey! nice work on the new stuff I just tested it but I have some questions

1) how do you reconfigure the things? after saved, I think the settings file should be used still for the defaults in the form IMHO

2) files should be in the "disk" of the ESP32, not as .h resources too, uploading takes a lot of time this way (but this I can move eventually)

3) how you think the laggyness could be fixed? my routine for the buttons is:

void delay_with_button_loop(int ms)
{ 
  dirty = false;
  long exit = millis()+ms;
  do{ 
    button1.loop(); 
    button2.loop(); 

    if(millis() > sleep_next_after)
    {
      sleep_now_and_wait();
    }

    if(dirty)
      return; // Just abort
    else
      delay(10);
  } while(millis()<exit);
}

and I replaced your delays with that, so the buttons execute their stuff, but it is not responsive all the time while the esp32 is busy. I am not sure if it should actually use the other core of the ESP32 to keep it fluid... maybe?

rzeldent commented 2 years ago

Hi Erwin,

  1. After configuring and you want to reconfigure, there are two possibilities. If the wifi is correct you can go to the IP of the device using a browser and (after entering 'admin' and the (AP_password), you enter the config again. Otherwise, always after a reset, you have 30 seconds to connect to the Wifi hotspot named FlightRadar using the AP password. Also here you enter the configuration. If everything fails, just recompile with a new config version value and it will be clean.

  2. There is not much space left on the eeprom so any file system overhead is waste. On top of that, uploading to the "disk" is another step. This could be done automatically but just flashing is easier. However, could be an option for additional files.

  3. With regard to 3. add the button1.loop and button2.loop to the main loop and create a new state. What should the button do exactly?

On Fri, Jun 17, 2022 at 10:33 PM Erwin Ried @.***> wrote:

Take a look at the latest commit. You can add new states. Right now there is only a state called display_flights but this state could be changed by a keypress and show other information...

Hey! nice work on the new stuff I just tested it but I have some questions

1.

how do you reconfigure the things? after saved, I think the settings file should be used still for the defaults in the form IMHO 2.

files should be in the "disk" of the ESP32, not as .h resources too, uploading takes a lot of time this way (but this I can move eventually) 3.

how you think the laggyness could be fixed? my routine for the buttons is:

void delay_with_button_loop(int ms) { dirty = false; long exit = millis()+ms; do{ button1.loop(); button2.loop();

if(millis() > sleep_next_after)
{
  sleep_now_and_wait();
}

if(dirty)
  return; // Just abort
else
  delay(10);

} while(millis()<exit); }

and I replaced your delays with that, so the buttons execute their stuff, but it is not responsive all the time while the esp32 is busy. I am not sure if it should actually use the other core of the ESP32 to keep it fluid... maybe?

— Reply to this email directly, view it on GitHub https://github.com/rzeldent/esp32-flightradar24-ttgo/issues/32#issuecomment-1159209759, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB2ENB7JNA4OCVHSDN6JF6DVPTOLLANCNFSM5YO32AOQ . You are receiving this because you commented.Message ID: @.***>

eried commented 2 years ago

On top of that, uploading to the "disk" is another step

This will happen only on changes, so most of the uploads will be less than 5 secs

What should the button do exactly?

Example, skip to next airplane right now but in the loop you will see how unresponsive it is

rzeldent commented 2 years ago

Am busy (see branch) sobutton1 switches to the next flight. Should work already...

On Sat, Jun 18, 2022 at 4:40 AM Erwin Ried @.***> wrote:

On top of that, uploading to the "disk" is another step

This will happen only on changes, so most of the uploads will be less than 5 secs

What should the button do exactly?

Example, skip to next airplane right now but in the loop you will see how unresponsive it is

— Reply to this email directly, view it on GitHub https://github.com/rzeldent/esp32-flightradar24-ttgo/issues/32#issuecomment-1159345742, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB2ENB72VU2NO4MFB6YMTV3VPUZLJANCNFSM5YO32AOQ . You are receiving this because you commented.Message ID: @.***>

eried commented 2 years ago

No, but I mean I have my version fully working with sleep and next flight, battery gauge, etc, but how responsive it is the buttons is the bad part because there is some routines that take few seconds, so you have to press the button in the right instant to get it to work. I havent created a PR because I havent solved the responsiveness.

Also the wake up takes 2 seconds, which is also lame.