You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

54 lines
1.2 KiB

  1. #include <string.h>
  2. #include "core/common.h"
  3. #include "core/buttons.h"
  4. #include "core/display.h"
  5. #include <epaper/EPD.h>
  6. #include "reader/reader_storage.h"
  7. #include "InternalMemoryMenuMode.h"
  8. void InternalMemoryMenuMode::start()
  9. {
  10. display_refresh();
  11. }
  12. void InternalMemoryMenuMode::loop()
  13. {
  14. char text[1024];
  15. //display_clear();
  16. EPD_setFont(COMIC24_FONT, NULL);
  17. EPD_print("Internal Memory", CENTER, 00);
  18. EPD_setFont(DEJAVU18_FONT, NULL);
  19. // TODO: free memory?
  20. EPD_print("Size:", 5, 40);
  21. long length = reader_storage_get_length();
  22. if (length < 0) {
  23. strcpy(text, "unknown");
  24. } else {
  25. sprintf(text, "%ld kB", length / 1024);
  26. }
  27. EPD_print(text, 100, 40);
  28. EPD_print("Position:", 5, 70);
  29. long position = reader_storage_get_position();
  30. if (position < 0) {
  31. strcpy(text, "unknown");
  32. } else {
  33. sprintf(text, "%d%%", (int)(position * 100 / length));
  34. }
  35. EPD_print(text, 100, 70);
  36. display_update();
  37. while (1) {
  38. delay(10);
  39. if (buttons_pressed_ok()) {
  40. this->setFinished();
  41. break;
  42. }
  43. }
  44. }
  45. void InternalMemoryMenuMode::finish()
  46. {}