S&B Volcano vaporizer remote control with Pi Pico W
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.

state_settings.c 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * state_settings.c
  3. *
  4. * Copyright (c) 2023 Thomas Buck (thomas@xythobuz.de)
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * See <http://www.gnu.org/licenses/>.
  17. */
  18. #include <stdio.h>
  19. #include <string.h>
  20. #include "config.h"
  21. #include "log.h"
  22. #include "menu.h"
  23. #include "mem.h"
  24. #include "state.h"
  25. #include "state_settings.h"
  26. static void enter_cb(int selection) {
  27. switch (selection) {
  28. case 0:
  29. // Auto Connect
  30. break;
  31. case 1:
  32. // Brightness
  33. break;
  34. case 2:
  35. // Workflows
  36. break;
  37. case 3:
  38. // Reset
  39. mem_load_defaults();
  40. break;
  41. }
  42. }
  43. static void exit_cb(void) {
  44. state_switch(STATE_SCAN);
  45. }
  46. void state_settings_enter(void) {
  47. menu_init(enter_cb, NULL, NULL, exit_cb);
  48. }
  49. void state_settings_exit(void) {
  50. menu_deinit();
  51. }
  52. static void draw(struct menu_state *menu) {
  53. int pos = 0;
  54. menu->length = 0;
  55. ADD_STATIC_ELEMENT("Auto Connect");
  56. ADD_STATIC_ELEMENT("Brightness");
  57. ADD_STATIC_ELEMENT("Workflows");
  58. ADD_STATIC_ELEMENT("Reset");
  59. if (menu->selection < 0) {
  60. menu->selection = 0;
  61. }
  62. }
  63. void state_settings_run(void) {
  64. menu_run(draw, false);
  65. }