Fixes for wav2c.sh script.

Newer LCDMenuLib2.
pull/107/head
Holger Wirtz 3 years ago
parent 21fd0810ff
commit 18efb18c08
  1. 1
      addon/Drums/Drums.txt
  2. 0
      addon/Drums/S_I_ARR1.wav
  3. 69
      addon/Drums/drumset.cfg
  4. 119
      addon/tools/drumset.cfg
  5. 3077
      addon/tools/drumset.h
  6. 29
      addon/tools/wav2c.sh
  7. 2
      drums.h
  8. 450348
      drumset.h
  9. 2
      third-party/LCDMenuLib2/LICENSE
  10. 5
      third-party/LCDMenuLib2/README.md
  11. 15
      third-party/LCDMenuLib2/examples/00_beginners/LCDML_000_serialMonitor/LCDML_000_serialMonitor.ino
  12. 1
      third-party/LCDMenuLib2/examples/00_beginners/LCDML_000_serialMonitor/LCDML_control.ino
  13. 6
      third-party/LCDMenuLib2/examples/00_beginners/LCDML_001_liquidCrystal/LCDML_001_liquidCrystal.ino
  14. 1
      third-party/LCDMenuLib2/examples/00_beginners/LCDML_001_liquidCrystal/LCDML_control.ino
  15. 15
      third-party/LCDMenuLib2/examples/01_backend/LCDML_010_simpleThread/LCDML_010_simpleThread.ino
  16. 1
      third-party/LCDMenuLib2/examples/01_backend/LCDML_010_simpleThread/LCDML_control.ino
  17. 15
      third-party/LCDMenuLib2/examples/01_backend/LCDML_011_TaskScheduler/LCDML_011_TaskScheduler.ino
  18. 1
      third-party/LCDMenuLib2/examples/01_backend/LCDML_011_TaskScheduler/LCDML_control.ino
  19. 15
      third-party/LCDMenuLib2/examples/02_functionality/LCDML_020_filelist/LCDML_020_filelist.ino
  20. 1
      third-party/LCDMenuLib2/examples/02_functionality/LCDML_020_filelist/LCDML_control.ino
  21. 20
      third-party/LCDMenuLib2/examples/02_functionality/LCDML_021_dynUpdatedContent/LCDML_021_dynUpdatedContent.ino
  22. 1
      third-party/LCDMenuLib2/examples/02_functionality/LCDML_021_dynUpdatedContent/LCDML_control.ino
  23. 38
      third-party/LCDMenuLib2/examples/02_functionality/LCDML_021_dynUpdatedContent/LCDML_display_dynFunction.ino
  24. 34
      third-party/LCDMenuLib2/examples/02_functionality/LCDML_021_dynUpdatedContent/LCDML_display_menu.ino
  25. 15
      third-party/LCDMenuLib2/examples/02_functionality/LCDML_022_multiLanguage/LCDML_022_multiLanguage.ino
  26. 1
      third-party/LCDMenuLib2/examples/02_functionality/LCDML_022_multiLanguage/LCDML_control.ino
  27. 1
      third-party/LCDMenuLib2/examples/02_functionality/LCDML_023_multiLanguage_small/LCDML_control.ino
  28. 7
      third-party/LCDMenuLib2/examples/02_functionality/LCDML_024_condetions/LCDML_024_condetions.ino
  29. 1
      third-party/LCDMenuLib2/examples/02_functionality/LCDML_024_condetions/LCDML_control.ino
  30. 0
      third-party/LCDMenuLib2/examples/03_displaytypes/01_lcd/LCDML_03011_i2c_display_20x4/LCDML_03011_i2c_display_20x4.ino
  31. 1
      third-party/LCDMenuLib2/examples/03_displaytypes/01_lcd/LCDML_03011_i2c_display_20x4/LCDML_control.ino
  32. 0
      third-party/LCDMenuLib2/examples/03_displaytypes/01_lcd/LCDML_03011_i2c_display_20x4/LCDML_display_menu.ino
  33. 0
      third-party/LCDMenuLib2/examples/03_displaytypes/01_lcd/LCDML_03011_i2c_display_20x4/LCDML_display_menuFunction.ino
  34. 6
      third-party/LCDMenuLib2/examples/03_displaytypes/01_lcd/LCDML_03012_liquidcrystal_20x4/LCDML_03012_liquidcrystal_20x4.ino
  35. 0
      third-party/LCDMenuLib2/examples/03_displaytypes/01_lcd/LCDML_03012_liquidcrystal_20x4/LCDML_condition.ino
  36. 1
      third-party/LCDMenuLib2/examples/03_displaytypes/01_lcd/LCDML_03012_liquidcrystal_20x4/LCDML_control.ino
  37. 0
      third-party/LCDMenuLib2/examples/03_displaytypes/01_lcd/LCDML_03012_liquidcrystal_20x4/LCDML_display_dynFunction.ino
  38. 0
      third-party/LCDMenuLib2/examples/03_displaytypes/01_lcd/LCDML_03012_liquidcrystal_20x4/LCDML_display_menu.ino
  39. 0
      third-party/LCDMenuLib2/examples/03_displaytypes/01_lcd/LCDML_03012_liquidcrystal_20x4/LCDML_display_menuFunction.ino
  40. 8
      third-party/LCDMenuLib2/examples/03_displaytypes/02_glcd/LCDML_03021_u8g2lib/LCDML_03021_u8g2lib.ino
  41. 0
      third-party/LCDMenuLib2/examples/03_displaytypes/02_glcd/LCDML_03021_u8g2lib/LCDML_condition.ino
  42. 1
      third-party/LCDMenuLib2/examples/03_displaytypes/02_glcd/LCDML_03021_u8g2lib/LCDML_control.ino
  43. 0
      third-party/LCDMenuLib2/examples/03_displaytypes/02_glcd/LCDML_03021_u8g2lib/LCDML_display_dynFunction.ino
  44. 0
      third-party/LCDMenuLib2/examples/03_displaytypes/02_glcd/LCDML_03021_u8g2lib/LCDML_display_menu.ino
  45. 0
      third-party/LCDMenuLib2/examples/03_displaytypes/02_glcd/LCDML_03021_u8g2lib/LCDML_display_menuFunction.ino
  46. 8
      third-party/LCDMenuLib2/examples/03_displaytypes/02_glcd/LCDML_03022_u8glib/LCDML_03022_u8glib.ino
  47. 0
      third-party/LCDMenuLib2/examples/03_displaytypes/02_glcd/LCDML_03022_u8glib/LCDML_condition.ino
  48. 1
      third-party/LCDMenuLib2/examples/03_displaytypes/02_glcd/LCDML_03022_u8glib/LCDML_control.ino
  49. 0
      third-party/LCDMenuLib2/examples/03_displaytypes/02_glcd/LCDML_03022_u8glib/LCDML_display_dynFunction.ino
  50. 0
      third-party/LCDMenuLib2/examples/03_displaytypes/02_glcd/LCDML_03022_u8glib/LCDML_display_menu.ino
  51. 0
      third-party/LCDMenuLib2/examples/03_displaytypes/02_glcd/LCDML_03022_u8glib/LCDML_display_menuFunction.ino
  52. 12
      third-party/LCDMenuLib2/examples/03_displaytypes/03_gfx/LCDML_03031_adafruit_gfx_ssd1306/LCDML_03031_adafruit_gfx_ssd1306.ino
  53. 0
      third-party/LCDMenuLib2/examples/03_displaytypes/03_gfx/LCDML_03031_adafruit_gfx_ssd1306/LCDML_condition.ino
  54. 646
      third-party/LCDMenuLib2/examples/03_displaytypes/03_gfx/LCDML_03031_adafruit_gfx_ssd1306/LCDML_control.ino
  55. 0
      third-party/LCDMenuLib2/examples/03_displaytypes/03_gfx/LCDML_03031_adafruit_gfx_ssd1306/LCDML_display_dynFunction.ino
  56. 0
      third-party/LCDMenuLib2/examples/03_displaytypes/03_gfx/LCDML_03031_adafruit_gfx_ssd1306/LCDML_display_menu.ino
  57. 0
      third-party/LCDMenuLib2/examples/03_displaytypes/03_gfx/LCDML_03031_adafruit_gfx_ssd1306/LCDML_display_menuFunction.ino
  58. 6
      third-party/LCDMenuLib2/examples/03_displaytypes/03_gfx/LCDML_03032_adafruit_gfx_st7735/LCDML_03032_adafruit_gfx_st7735.ino
  59. 0
      third-party/LCDMenuLib2/examples/03_displaytypes/03_gfx/LCDML_03032_adafruit_gfx_st7735/LCDML_condition.ino
  60. 646
      third-party/LCDMenuLib2/examples/03_displaytypes/03_gfx/LCDML_03032_adafruit_gfx_st7735/LCDML_control.ino
  61. 0
      third-party/LCDMenuLib2/examples/03_displaytypes/03_gfx/LCDML_03032_adafruit_gfx_st7735/LCDML_display_dynFunction.ino
  62. 0
      third-party/LCDMenuLib2/examples/03_displaytypes/03_gfx/LCDML_03032_adafruit_gfx_st7735/LCDML_display_menu.ino
  63. 0
      third-party/LCDMenuLib2/examples/03_displaytypes/03_gfx/LCDML_03032_adafruit_gfx_st7735/LCDML_display_menuFunction.ino
  64. 647
      third-party/LCDMenuLib2/examples/03_displaytypes/lcd/LCDML_i2c_display_20x4/LCDML_control.ino
  65. 647
      third-party/LCDMenuLib2/examples/03_displaytypes/lcd/LCDML_liquidcrystal_20x4/LCDML_control.ino
  66. 16
      third-party/LCDMenuLib2/keywords.txt
  67. 6
      third-party/LCDMenuLib2/library.properties
  68. 252
      third-party/LCDMenuLib2/src/LCDMenuLib2.cpp
  69. 32
      third-party/LCDMenuLib2/src/LCDMenuLib2.h
  70. 2
      third-party/LCDMenuLib2/src/LCDMenuLib2_macros.h
  71. 25
      third-party/LCDMenuLib2/src/LCDMenuLib2_menu.cpp
  72. 42
      third-party/LCDMenuLib2/src/LCDMenuLib2_menu.h
  73. 2
      third-party/LCDMenuLib2/src/LCDMenuLib2_typedef.h
  74. 1
      third-party/teensy-variable-playback

@ -1,69 +0,0 @@
# class, midinote, name, shortname, pitch, pan, vol_max, vol_min, reverb_send, filename
DRUM_HIHAT, 210, SQBass, B, 0.0, 0.0, 0.8, 0.0, 0.0, I_SQBass.wav
DRUM_MIDTOM, 211, CALLIOP, B, 0.0, 0.0, 0.8, 0.0, 0.0, I_CALLIOP.wav
DRUM_CRASH, 212, CALLIOP, B, 0.0, 0.0, 0.8, 0.0, 0.0, I_CALLIOP.wav
DRUM_RIDE, 213, ARR1, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_I_ARR1.wav
DRUM_BASS, 214, FVoice, B, 0.0, 0.0, 0.8, 0.0, 0.0, I_FVoicG2.wav
DRUM_BASS, MIDI_A2, Clap808, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_kick_1.wav
DRUM_BASS, MIDI_B2, S_kick_1, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_kick_1.wav
DRUM_BASS, MIDI_C3, S_kick2_8, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_kick2_8.wav
DRUM_PERCUSSION, MIDI_CIS3, S_Stick_1, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_snareStick_1.wav
DRUM_SNARE, MIDI_D3, S_snare_Ghost_1, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_snare_Ghost_1.wav
DRUM_SNARE, MIDI_DIS3, S_snare2_Ghost_1, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_snare2_Ghost_1.wav
DRUM_SNARE, MIDI_E3, S_snare_2, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_snare_2.wav
DRUM_BASS, MIDI_F3, S_loTom_1, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_loTom_1.wav
DRUM_BASS, MIDI_FIS3, S_hhClosed_1, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_hhClosed_1.wav
DRUM_LOWTOM, MIDI_G3, S_loTom_1, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_loTom_1.wav
DRUM_BASS, MIDI_GIS3, S_hh_o_1_2, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_hh_o_1_2.wav
DRUM_HIGHTOM, MIDI_A3, S_hiTom_5, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_hiTom_5.wav
DRUM_BASS, MIDI_AIS3, S_hh_o_5_4 , B, 0.0, 0.0, 0.8, 0.0, 0.0, S_hh_o_5_4.wav
DRUM_HIGHTOM, MIDI_B3, S_hiTom_5, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_hiTom_5.wav
DRUM_HIGHTOM, MIDI_C4, S_hiTom_5, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_hiTom_5.wav
DRUM_BASS, MIDI_CIS4, S_splash1_1, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_splash1_1.wav
DRUM_HIGHTOM, MIDI_D4, S_hiTom_5, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_hiTom_5.wav
DRUM_CRASH, MIDI_DIS4, S_china1_4, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_china1_4.wav
DRUM_CRASH, MIDI_E4, S_china2_1, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_china2_1.wav
DRUM_RIDE, MIDI_F4, S_ride1Bell_1, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_ride1Bell_1.wav
DRUM_RIDE, MIDI_FIS4, S_ride1Bell_1, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_ride1Bell_1.wav
DRUM_CRASH, MIDI_G4, S_crash1_1, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_crash1_1.wav
DRUM_BASS, MIDI_GIS4, S_cowbell_2, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_cowbell_2.wav
DRUM_RIDE, MIDI_A4, S_ride2Crash_2, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_ride2Crash_2.wav
DRUM_RIDE, MIDI_AIS4, S_ride2_1, B, 0.0, 0.0, 0.8, 0.0, 0.0, S_ride2_1.wav
DRUM_BASS, MIDI_B4, 808Kick, B, 0.0, 0.0, 0.8, 0.0, 0.0, Kick808.wav
DRUM_BASS, MIDI_C5, phkick1, B, 0.0, 0.0, 1.0, 0.0, 0.0, phKick1.wav
DRUM_SNARE, MIDI_CIS5, rims1, R, 0.0, -0.2, 0.7, 0.0, 0.0, Rim808.wav
DRUM_SNARE, MIDI_D5, Shaker, R, 0.0, -0.2, 0.5, 0.0, 0.0, Shaker.wav
DRUM_HANDCLAP, MIDI_DIS5, LNclap1, C, 0.0, 0.1, 0.9, 0.0, 0.1, LnClap.wav
DRUM_SNARE, MIDI_E5, LNsnare1, S, 0.0, 0.0, 0.9, 0.0, 0.0, LnSnare1.wav
DRUM_BASS, MIDI_F5, Bdtrancy, B, 0.0, 0.0, 0.9, 0.0, 0.0, BDTrancy.wav
DRUM_HIHAT, MIDI_FIS5, hhcl1, H, 0.0, 1.0, 0.6, 0.0, 0.0, HhCL1-808.wav
DRUM_BASS, MIDI_G5, Belltree, B, 0.0, 0.0, 0.7, 0.0, 0.0, Belltree.wav
DRUM_BASS, MIDI_GIS5, Bongo16, B, 0.0, 0.0, 0.9, 0.0, 0.0, Bongo16.wav
DRUM_BASS, MIDI_A5, Bongo27, B, 0.0, 0.0, 0.9, 0.0, 0.0, Bongo27.wav
DRUM_BASS, MIDI_AIS5, Casta, B, 0.0, 0.0, 0.9, 0.0, 0.0, Casta.wav
DRUM_BASS, MIDI_B5, Cr78kick, B, 0.0, 0.0, 1.0, 0.0, 0.0, CR78Kick.wav
DRUM_HIHAT, MIDI_C6, Cr78tmb1, B, 0.0, 0.0, 0.8, 0.0, 0.0, CR78Tmb1.wav
DRUM_HIHAT, MIDI_CIS6, Cr78tmb2, B, 0.0, 0.0, 0.8, 0.0, 0.0, CR78Tmb2.wav
DRUM_BASS, MIDI_D6, Crash1, B, 0.0, 0.0, 0.9, 0.0, 0.0, Crash1.wav
DRUM_BASS, MIDI_DIS6, Dmpop, B, 0.0, 0.0, 0.9, 0.0, 0.0, DMpop.wav
DRUM_BASS, MIDI_E6, Electr1, B, 0.0, 0.0, 0.9, 0.0, 0.0, Electr1.wav
DRUM_BASS, MIDI_F6, Excow, B, 0.0, 0.0, 0.9, 0.0, 0.0, EXcow.wav
DRUM_PERCUSSION, MIDI_FIS6, Tamb, T, 0.0, -0.2, 0.6, 0.0, 0.0, Tamb.wav
DRUM_PERCUSSION, MIDI_GIS6, Cowbell, S, 0.0, 0.2, 0.6, 0.0, 0.0, CowBell.wav
DRUM_HIHAT, MIDI_G6, 660HatC1, T, 0.0, 0.0, 0.6, 0.0, 0.0, HatC660.wav
DRUM_HIHAT, MIDI_A6, Hhopen1, S, 0.0, 0.0, 0.6, 0.0, 0.0, HHopen1.wav
DRUM_PERCUSSION, MIDI_AIS6, Histicks, S, 0.0, 0.0, 0.6, 0.0, 0.0, HiSticks.wav
DRUM_PERCUSSION, MIDI_B6, Hr16snr2, S, 0.0, 0.0, 0.6, 0.0, 0.0, HR16Snr2.wav
DRUM_HIGHTOM, MIDI_C7, Xrhitom, B, 0.0, 0.0, 0.8, 0.0, 0.0, XRHiTom.wav
DRUM_PERCUSSION, MIDI_CIS7, Tick1, S, 0.0, 0.0, 0.9, 0.0, 0.0, Tick1.wav
DRUM_PERCUSSION, MIDI_D7, M1-18, S, 0.0, 0.0, 0.9, 0.0, 0.0, M1-18.wav
DRUM_PERCUSSION, MIDI_DIS7, Md16_clp, S, 0.0, 0.0, 0.9, 0.0, 0.0, MD16_CLP.wav
DRUM_HIHAT, MIDI_E7, Ohhwav, S, 0.0, 0.0, 0.9, 0.0, 0.0, OHH909.wav
DRUM_PERCUSSION, MIDI_F7, Quijada, S, 0.0, 0.0, 0.9, 0.0, 0.0, Quijada.wav
DRUM_PERCUSSION, MIDI_FIS7, tabla1, S, 0.0, 0.0, 0.9, 0.0, 0.0, R8Tabla1.wav
DRUM_PERCUSSION, MIDI_G7, Ride808, S, 0.0, 0.0, 0.9, 0.0, 0.0, Ride808.wav
DRUM_PERCUSSION, MIDI_GIS7, Scratch1, S, 0.0, 0.0, 0.7, 0.0, 0.0, scratch1.wav
DRUM_PERCUSSION, MIDI_A7, Tomlow, S, 0.0, 0.0, 0.9, 0.0, 0.0, TomLow.wav
DRUM_PERCUSSION, MIDI_AIS7, Tom808, S, 0.0, 0.0, 0.9, 0.0, 0.0, Tom808.wav
DRUM_BASS, MIDI_B7, Vl1lbeep, B, 0.0, 0.0, 0.8, 0.0, 0.0, vl1-Lbeep.wav
DRUM_BASS, MIDI_C8, Vl1hbeep, B, 0.0, 0.0, 0.8, 0.0, 0.0, vl1-Hbeep.wav

@ -1,50 +1,69 @@
# class, midinote, name, shortname, pitch, pan, vol_max, vol_min, reverb_send, filename
DRUM_BASS, MIDI_A2, Xrhitom, B, 0.0, 0.0, 0.8, 0.0, 0.0, bd01.wav
DRUM_BASS, MIDI_AIS2, Vl1lbeep, B, 0.0, 0.0, 0.8, 0.0, 0.0, bd01.wav
DRUM_BASS, MIDI_B2, Vl1hbeep, B, 0.0, 0.0, 0.8, 0.0, 0.0, bd01.wav
DRUM_BASS, MIDI_C3, bd01, B, 0.0, 0.0, 0.8, 0.0, 0.0, bd01.wav
DRUM_HANDCLAP, MIDI_CIS3, cp02l, C, 0.0, -1.0, 0.6, 0.0, 0.1, bd01.wav
DRUM_HANDCLAP, MIDI_DIS3, cp02r, C, 0.0, 1.0, 0.6, 0.0, 0.2, bd01.wav
DRUM_SNARE, MIDI_D3, sd15, S, 0.0, 0.2, 0.6, 0.2, 0.0, bd01.wav
DRUM_HIHAT, MIDI_FIS3, hh01, h, 0.0, 0.8, 0.8, 0.3, 0.0, bd01.wav
DRUM_HIHAT, MIDI_GIS3, hh02, h, 0.0, 0.8, 0.8, 0.3, 0.0, bd01.wav
DRUM_HIHAT, MIDI_AIS3, oh02, H, 0.0, 0.8, 0.8, 0.3, 0.0, bd01.wav
DRUM_LOWTOM, MIDI_G3, lt01, T, 0.0, -0.7, 0.8, 0.0, 0.0, bd01.wav
DRUM_HIGHTOM, MIDI_A3, ht01, T, 0.0, -0.5, 0.8, 0.0, 0.0, bd01.wav
DRUM_RIDE, MIDI_CIS4, rd01, R, 0.0, -0.6, 0.3, 0.0, 0.0, bd01.wav
DRUM_RIDE, MIDI_DIS4, rd02, R, 0.0, -0.6, 0.3, 0.0, 0.0, bd01.wav
DRUM_BASS, MIDI_B4, 808Kick, B, 0.0, 0.0, 0.8, 0.0, 0.0, bd01.wav
DRUM_BASS, MIDI_C5, phkick1, B, 0.0, 0.0, 1.0, 0.0, 0.0, bd01.wav
DRUM_SNARE, MIDI_CIS5, rims1, R, 0.0, -0.2, 0.7, 0.0, 0.0, bd01.wav
DRUM_SNARE, MIDI_D5, Shaker, R, 0.0, -0.2, 0.5, 0.0, 0.0, bd01.wav
DRUM_SNARE, MIDI_E5, LNsnare1, S, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav
DRUM_HANDCLAP, MIDI_DIS5, LNclap1, C, 0.0, 0.1, 0.9, 0.0, 0.1, bd01.wav
DRUM_BASS, MIDI_F5, Bdtrancy, B, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav
DRUM_HIHAT, MIDI_FIS5, hhcl1, H, 0.0, 1.0, 0.6, 0.0, 0.0, bd01.wav
DRUM_BASS, MIDI_G5, Belltree, B, 0.0, 0.0, 0.7, 0.0, 0.0, bd01.wav
DRUM_BASS, MIDI_GIS5, Bongo16, B, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav
DRUM_BASS, MIDI_A5, Bongo27, B, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav
DRUM_BASS, MIDI_AIS5, Casta, B, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav
DRUM_BASS, MIDI_B5, Cr78kick, B, 0.0, 0.0, 1.0, 0.0, 0.0, bd01.wav
DRUM_HIHAT, MIDI_C6, Cr78tmb1, B, 0.0, 0.0, 0.8, 0.0, 0.0, bd01.wav
DRUM_HIHAT, MIDI_CIS6, Cr78tmb2, B, 0.0, 0.0, 0.8, 0.0, 0.0, bd01.wav
DRUM_BASS, MIDI_D6, Crash1, B, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav
DRUM_BASS, MIDI_DIS6, Dmpop, B, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav
DRUM_BASS, MIDI_E6, Electr1, B, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav
DRUM_BASS, MIDI_F6, Excow, B, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav
DRUM_PERCUSSION, MIDI_FIS6, Tamb, T, 0.0, -0.2, 0.6, 0.0, 0.0, bd01.wav
DRUM_PERCUSSION, MIDI_GIS6, Cowbell, S, 0.0, 0.2, 0.6, 0.0, 0.0, bd01.wav
DRUM_HIHAT, MIDI_G6, 660HatC1, T, 0.0, 0.0, 0.6, 0.0, 0.0, bd01.wav
DRUM_HIHAT, MIDI_A6, Hhopen1, S, 0.0, 0.0, 0.6, 0.0, 0.0, bd01.wav
DRUM_PERCUSSION, MIDI_AIS6, Histicks, S, 0.0, 0.0, 0.6, 0.0, 0.0, bd01.wav
DRUM_PERCUSSION, MIDI_B6, Hr16snr2, S, 0.0, 0.0, 0.6, 0.0, 0.0, bd01.wav
DRUM_PERCUSSION, MIDI_CIS7, Tick1, S, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav
DRUM_PERCUSSION, MIDI_D7, M118w, S, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav
DRUM_PERCUSSION, MIDI_DIS7, Md16_clp, S, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav
DRUM_HIHAT, MIDI_E7, Ohhwav, S, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav
DRUM_PERCUSSION, MIDI_F7, Quijada, S, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav
DRUM_PERCUSSION, MIDI_FIS7, tabla1, S, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav
DRUM_PERCUSSION, MIDI_GIS7, Ridewav, S, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav
DRUM_PERCUSSION, MIDI_A7, Scratch1, S, 0.0, 0.0, 0.7, 0.0, 0.0, bd01.wav
DRUM_PERCUSSION, MIDI_B7, Tomlow, S, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav
DRUM_PERCUSSION, MIDI_C8, Tomwav, S, 0.0, 0.0, 0.9, 0.0, 0.0, bd01.wav
# class, midinote, name, shortname, pitch, p_offset, pan, vol_max, vol_min, reverb_send, filename
DRUM_HIHAT, 210, SQBass, B, 0.0,0.0, 0.0, 0.8, 0.0, 0.0, I_SQBass.wav
DRUM_MIDTOM, 211, CALLIOP, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, I_CALLIOP.wav
DRUM_CRASH, 212, CALLIOP, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, I_CALLIOP.wav
DRUM_RIDE, 213, ARR1, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_I_ARR1.wav
DRUM_BASS, 214, FVoice, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, I_FVoicG2.wav
DRUM_BASS, MIDI_A2, Clap808, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_kick_1.wav
DRUM_BASS, MIDI_B2, S_kick_1, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_kick_1.wav
DRUM_BASS, MIDI_C3, S_kick2_8, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_kick2_8.wav
DRUM_PERCUSSION, MIDI_CIS3, S_Stick_1, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_snareStick_1.wav
DRUM_SNARE, MIDI_D3, S_snare_Ghost_1, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_snare_Ghost_1.wav
DRUM_SNARE, MIDI_DIS3, S_snare2_Ghost_1, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_snare2_Ghost_1.wav
DRUM_SNARE, MIDI_E3, S_snare_2, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_snare_2.wav
DRUM_BASS, MIDI_F3, S_loTom_1, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_loTom_1.wav
DRUM_BASS, MIDI_FIS3, S_hhClosed_1, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_hhClosed_1.wav
DRUM_LOWTOM, MIDI_G3, S_loTom_1, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_loTom_1.wav
DRUM_BASS, MIDI_GIS3, S_hh_o_1_2, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_hh_o_1_2.wav
DRUM_HIGHTOM, MIDI_A3, S_hiTom_5, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_hiTom_5.wav
DRUM_BASS, MIDI_AIS3, S_hh_o_5_4 , B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_hh_o_5_4.wav
DRUM_HIGHTOM, MIDI_B3, S_hiTom_5, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_hiTom_5.wav
DRUM_HIGHTOM, MIDI_C4, S_hiTom_5, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_hiTom_5.wav
DRUM_BASS, MIDI_CIS4, S_splash1_1, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_splash1_1.wav
DRUM_HIGHTOM, MIDI_D4, S_hiTom_5, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_hiTom_5.wav
DRUM_CRASH, MIDI_DIS4, S_china1_4, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_china1_4.wav
DRUM_CRASH, MIDI_E4, S_china2_1, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_china2_1.wav
DRUM_RIDE, MIDI_F4, S_ride1Bell_1, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_ride1Bell_1.wav
DRUM_RIDE, MIDI_FIS4, S_ride1Bell_1, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_ride1Bell_1.wav
DRUM_CRASH, MIDI_G4, S_crash1_1, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_crash1_1.wav
DRUM_BASS, MIDI_GIS4, S_cowbell_2, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_cowbell_2.wav
DRUM_RIDE, MIDI_A4, S_ride2Crash_2, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_ride2Crash_2.wav
DRUM_RIDE, MIDI_AIS4, S_ride2_1, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, S_ride2_1.wav
DRUM_BASS, MIDI_B4, 808Kick, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, Kick808.wav
DRUM_BASS, MIDI_C5, phkick1, B, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, phKick1.wav
DRUM_SNARE, MIDI_CIS5, rims1, R, 0.0, 0.0, -0.2, 0.7, 0.0, 0.0, Rim808.wav
DRUM_SNARE, MIDI_D5, Shaker, R, 0.0, 0.0, -0.2, 0.5, 0.0, 0.0, Shaker.wav
DRUM_HANDCLAP, MIDI_DIS5, LNclap1, C, 0.0, 0.0, 0.1, 0.9, 0.0, 0.1, LnClap.wav
DRUM_SNARE, MIDI_E5, LNsnare1, S, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, LnSnare1.wav
DRUM_BASS, MIDI_F5, Bdtrancy, B, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, BDTrancy.wav
DRUM_HIHAT, MIDI_FIS5, hhcl1, H, 0.0, 0.0, 1.0, 0.6, 0.0, 0.0, HhCL1-808.wav
DRUM_BASS, MIDI_G5, Belltree, B, 0.0, 0.0, 0.0, 0.7, 0.0, 0.0, Belltree.wav
DRUM_BASS, MIDI_GIS5, Bongo16, B, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, Bongo16.wav
DRUM_BASS, MIDI_A5, Bongo27, B, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, Bongo27.wav
DRUM_BASS, MIDI_AIS5, Casta, B, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, Casta.wav
DRUM_BASS, MIDI_B5, Cr78kick, B, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, CR78Kick.wav
DRUM_HIHAT, MIDI_C6, Cr78tmb1, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, CR78Tmb1.wav
DRUM_HIHAT, MIDI_CIS6, Cr78tmb2, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, CR78Tmb2.wav
DRUM_BASS, MIDI_D6, Crash1, B, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, Crash1.wav
DRUM_BASS, MIDI_DIS6, Dmpop, B, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, DMpop.wav
DRUM_BASS, MIDI_E6, Electr1, B, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, Electr1.wav
DRUM_BASS, MIDI_F6, Excow, B, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, EXcow.wav
DRUM_PERCUSSION, MIDI_FIS6, Tamb, T, 0.0, 0.0, -0.2, 0.6, 0.0, 0.0, Tamb.wav
DRUM_PERCUSSION, MIDI_GIS6, Cowbell, S, 0.0, 0.0, 0.2, 0.6, 0.0, 0.0, CowBell.wav
DRUM_HIHAT, MIDI_G6, 660HatC1, T, 0.0, 0.0, 0.0, 0.6, 0.0, 0.0, HatC660.wav
DRUM_HIHAT, MIDI_A6, Hhopen1, S, 0.0, 0.0, 0.0, 0.6, 0.0, 0.0, HHopen1.wav
DRUM_PERCUSSION, MIDI_AIS6, Histicks, S, 0.0, 0.0, 0.0, 0.6, 0.0, 0.0, HiSticks.wav
DRUM_PERCUSSION, MIDI_B6, Hr16snr2, S, 0.0, 0.0, 0.0, 0.6, 0.0, 0.0, HR16Snr2.wav
DRUM_HIGHTOM, MIDI_C7, Xrhitom, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, XRHiTom.wav
DRUM_PERCUSSION, MIDI_CIS7, Tick1, S, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, Tick1.wav
DRUM_PERCUSSION, MIDI_D7, M1-18, S, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, M1-18.wav
DRUM_PERCUSSION, MIDI_DIS7, Md16_clp, S, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, MD16_CLP.wav
DRUM_HIHAT, MIDI_E7, Ohhwav, S, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, OHH909.wav
DRUM_PERCUSSION, MIDI_F7, Quijada, S, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, Quijada.wav
DRUM_PERCUSSION, MIDI_FIS7, tabla1, S, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, R8Tabla1.wav
DRUM_PERCUSSION, MIDI_G7, Ride808, S, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, Ride808.wav
DRUM_PERCUSSION, MIDI_GIS7, Scratch1, S, 0.0, 0.0, 0.0, 0.7, 0.0, 0.0, scratch1.wav
DRUM_PERCUSSION, MIDI_A7, Tomlow, S, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, TomLow.wav
DRUM_PERCUSSION, MIDI_AIS7, Tom808, S, 0.0, 0.0, 0.0, 0.9, 0.0, 0.0, Tom808.wav
DRUM_BASS, MIDI_B7, Vl1lbeep, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, vl1-Lbeep.wav
DRUM_BASS, MIDI_C8, Vl1hbeep, B, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, vl1-Hbeep.wav

File diff suppressed because it is too large Load Diff

@ -3,7 +3,7 @@
# Converter for WAV to C Header
# Used for MicroDexed sampler
#
# (c) 2021 Holger Wirtz
# (C)2021 Holger Wirtz
#
SOX=`which sox`
@ -82,6 +82,8 @@ cat >> "${DRUMSET_H}" << EOF
#ifndef _DRUMSET_H
#define _DRUMSET_H
#include "drums.h"
EOF
rm -f "${DRUMS_H}"
cat >> "${DRUMS_H}" << EOF
@ -105,14 +107,16 @@ do
sample['class']=`echo "${samplecfg[0]}" | xargs`
sample['midinote']=`echo "${samplecfg[1]}" | xargs`
sample['name']=`echo "${samplecfg[2]}" | xargs`
sample['data_name']="${sample['name']}"
sample['c_name']=`echo "${samplecfg[2]}" | xargs | sed 's/[^a-zA-Z0-9]/_/g'`
sample['c_name']=`echo "DRUM_${sample[c_name]}"`
sample['shortname']=`echo "${samplecfg[3]}" | xargs`
sample['pitch']=`echo "${samplecfg[4]}" | xargs`
sample['pan']=`echo "${samplecfg[5]}" | xargs`
sample['vol_max']=`echo "${samplecfg[6]}" | xargs`
sample['vol_min']=`echo "${samplecfg[7]}" | xargs`
sample['reverb_send']=`echo "${samplecfg[8]}" | xargs`
sample['filename']=`echo "${samplecfg[9]}" | xargs`
sample['p_offset']=`echo "${samplecfg[5]}" | xargs`
sample['pan']=`echo "${samplecfg[6]}" | xargs`
sample['vol_max']=`echo "${samplecfg[7]}" | xargs`
sample['vol_min']=`echo "${samplecfg[8]}" | xargs`
sample['reverb_send']=`echo "${samplecfg[9]}" | xargs`
sample['filename']=`echo "${samplecfg[10]}" | xargs`
if [ -f "${WAV_DIR}/${sample['filename']}" ]
then
@ -121,6 +125,7 @@ do
then
# Generate drumset.h
echo "'${WAV_DIR}/${sample['filename']}' -> '${sample['c_name']}'"
NUM_DRUMSET_CONFIG=`expr "${NUM_DRUMSET_CONFIG}" + 1`
if [ -z "${converted_files[${sample['filename']}]}" ]
@ -135,7 +140,7 @@ do
sample['len']=`expr "${sample['len']}" / 2`
echo "// Converted from ${sample['filename']}, length = ${sample['len']} bytes" >> "${DRUMSET_H}"
echo "PROGMEM const uint8_t ${sample['name']}[] = {" >> "${DRUMSET_H}"
echo "PROGMEM const uint8_t ${sample['c_name']}[] = {" >> "${DRUMSET_H}"
grep "^ " "${TMP}/${basename}.h" >> "${DRUMSET_H}"
if (( "${fill}" > 0 ))
@ -157,9 +162,9 @@ do
fi
echo "};" >> "${DRUMSET_H}"
converted_files["${sample['filename']}"]="${sample['name']},${sample['len']}"
converted_files["${sample['filename']}"]="${sample['c_name']},${sample['len']}"
else
sample['data_name']=`echo ${converted_files[${sample['filename']}]} | cut -d"," -f1`
sample['c_name']=`echo ${converted_files[${sample['filename']}]} | cut -d"," -f1`
sample['len']=`echo ${converted_files[${sample['filename']}]} | cut -d"," -f2`
fi
@ -169,10 +174,11 @@ do
${sample[class]},
${sample[midinote]},
"${sample[name]}",
${sample[data_name]},
${sample[c_name]},
"${sample[shortname]}",
${sample[len]},
${sample[pitch]},
${sample[p_offset]},
${sample[pan]},
${sample[vol_max]},
${sample[vol_min]},
@ -197,6 +203,7 @@ cat >> "${DRUMS_H}" << EOF
0.0,
0.0,
0.0,
0.0,
0.0
}
};

@ -46,6 +46,4 @@ typedef struct drum_config_s {
enum {DRUM_NONE, DRUM_BASS, DRUM_SNARE, DRUM_HIHAT, DRUM_HANDCLAP, DRUM_RIDE, DRUM_CRASH, DRUM_LOWTOM, DRUM_MIDTOM, DRUM_HIGHTOM, DRUM_PERCUSSION};
#endif

450348
drumset.h

File diff suppressed because it is too large Load Diff

@ -1,6 +1,6 @@
MIT License
Copyright (c) [2020] [Nils Feldkämper]
Copyright (c) [2021] [Nils Feldkämper]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

@ -1,4 +1,5 @@
# **Arduino LCDMenuLib2 (LCDML) with layers for any LCD Type (row displays, graphic displays, console output)**
Arduino LCDMenuLib2 (LCDML) with layers for any LCD Type (Row Displays, Graphic Displays, Console output)
=================================================================
https://github.com/Jomelo/LCDMenuLib2/wiki/Code-Reference
@ -53,7 +54,7 @@ Images:
MIT License
Copyright (c) [2020] [Nils Feldkämper]
Copyright (c) [2021] [Nils Feldkämper]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

@ -44,15 +44,6 @@
LCDMenuLib2_menu LCDML_0 (255, 0, 0, NULL, NULL); // root menu element (do not change)
LCDMenuLib2 LCDML(LCDML_0, _LCDML_DISP_rows-_LCDML_DSIP_use_header, _LCDML_DISP_cols, lcdml_menu_display, lcdml_menu_clear, lcdml_menu_control);
// *********************************************************************
// LCDML MENU/DISP
// *********************************************************************
// LCDML_0 => layer 0
// LCDML_0_X => layer 1
// LCDML_0_X_X => layer 2
// LCDML_0_X_X_X => layer 3
// LCDML_0_... => layer ...
// *********************************************************************
// LCDML MENU/DISP
// *********************************************************************
@ -85,7 +76,7 @@
// Example for one function and different parameters
// It is recommend to use parameters for switching settings like, (small drink, medium drink, big drink) or (200ml, 400ml, 600ml, 800ml) ...
// the parameter change can also be released with dynParams on the next example
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (16 , LCDML_0 , 5 , NULL, "Parameter" , NULL, 0, _LCDML_TYPE_default); // NULL = no menu function
LCDML_addAdvanced (17 , LCDML_0_5 , 1 , NULL, "Parameter 1" , mFunc_para, 10, _LCDML_TYPE_default); // NULL = no menu function
LCDML_addAdvanced (18 , LCDML_0_5 , 2 , NULL, "Parameter 2" , mFunc_para, 20, _LCDML_TYPE_default); // NULL = no menu function
@ -97,13 +88,13 @@
// 1. set the string to ""
// 2. use type _LCDML_TYPE_dynParam instead of _LCDML_TYPE_default
// this function type can not be used in combination with different parameters
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (21 , LCDML_0 , 6 , NULL, "" , mDyn_para, 0, _LCDML_TYPE_dynParam); // NULL = no menu function
// Example for conditions (for example for a screensaver)
// 1. define a condition as a function of a boolean type -> return false = not displayed, return true = displayed
// 2. set the function name as callback (remove the braces '()' it gives bad errors)
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (22 , LCDML_0 , 7 , COND_hide, "screensaver" , mFunc_screensaver, 0, _LCDML_TYPE_default); // this menu function can be found on "LCDML_display_menuFunction" tab
// Example function for event handling (only serial output in this example)

@ -69,7 +69,6 @@ void lcdml_menu_control(void)
if(LCDML.CE_setup()) {
// runs only once
Serial.println("CE_setup()");
}
// check if new serial input is available

@ -98,7 +98,7 @@
// Example for one function and different parameters
// It is recommend to use parameters for switching settings like, (small drink, medium drink, big drink) or (200ml, 400ml, 600ml, 800ml) ...
// the parameter change can also be released with dynParams on the next example
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (16 , LCDML_0 , 5 , NULL, "Parameter" , NULL, 0, _LCDML_TYPE_default); // NULL = no menu function
LCDML_addAdvanced (17 , LCDML_0_5 , 1 , NULL, "Parameter 1" , mFunc_para, 10, _LCDML_TYPE_default); // NULL = no menu function
LCDML_addAdvanced (18 , LCDML_0_5 , 2 , NULL, "Parameter 2" , mFunc_para, 20, _LCDML_TYPE_default); // NULL = no menu function
@ -110,13 +110,13 @@
// 1. set the string to ""
// 2. use type _LCDML_TYPE_dynParam instead of _LCDML_TYPE_default
// this function type can not be used in combination with different parameters
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (21 , LCDML_0 , 6 , NULL, "" , mDyn_para, 0, _LCDML_TYPE_dynParam); // NULL = no menu function
// Example for conditions (for example for a screensaver)
// 1. define a condition as a function of a boolean type -> return false = not displayed, return true = displayed
// 2. set the function name as callback (remove the braces '()' it gives bad errors)
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (22 , LCDML_0 , 7 , COND_hide, "screensaver" , mFunc_screensaver, 0, _LCDML_TYPE_default); // this menu function can be found on "LCDML_display_menuFunction" tab
// ***TIP*** Try to update _LCDML_DISP_cnt when you add a menu element.

@ -69,7 +69,6 @@ void lcdml_menu_control(void)
if(LCDML.CE_setup()) {
// runs only once
Serial.println("CE_setup()");
}
// check if new serial input is available

@ -53,15 +53,6 @@
LCDMenuLib2_menu LCDML_0 (255, 0, 0, NULL, NULL); // root menu element (do not change)
LCDMenuLib2 LCDML(LCDML_0, _LCDML_DISP_rows, _LCDML_DISP_cols, lcdml_menu_display, lcdml_menu_clear, lcdml_menu_control);
// *********************************************************************
// LCDML MENU/DISP
// *********************************************************************
// LCDML_0 => layer 0
// LCDML_0_X => layer 1
// LCDML_0_X_X => layer 2
// LCDML_0_X_X_X => layer 3
// LCDML_0_... => layer ...
// *********************************************************************
// LCDML MENU/DISP
// *********************************************************************
@ -94,7 +85,7 @@
// Example for one function and different parameters
// It is recommend to use parameters for switching settings like, (small drink, medium drink, big drink) or (200ml, 400ml, 600ml, 800ml) ...
// the parameter change can also be released with dynParams on the next example
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (16 , LCDML_0 , 5 , NULL, "Parameter" , NULL, 0, _LCDML_TYPE_default); // NULL = no menu function
LCDML_addAdvanced (17 , LCDML_0_5 , 1 , NULL, "Parameter 1" , mFunc_para, 10, _LCDML_TYPE_default); // NULL = no menu function
LCDML_addAdvanced (18 , LCDML_0_5 , 2 , NULL, "Parameter 2" , mFunc_para, 20, _LCDML_TYPE_default); // NULL = no menu function
@ -106,13 +97,13 @@
// 1. set the string to ""
// 2. use type _LCDML_TYPE_dynParam instead of _LCDML_TYPE_default
// this function type can not be used in combination with different parameters
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (21 , LCDML_0 , 6 , NULL, "" , mDyn_para, 0, _LCDML_TYPE_dynParam); // NULL = no menu function
// Example for conditions (for example for a screensaver)
// 1. define a condition as a function of a boolean type -> return false = not displayed, return true = displayed
// 2. set the function name as callback (remove the braces '()' it gives bad errors)
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (22 , LCDML_0 , 7 , COND_hide, "screensaver" , mFunc_screensaver, 0, _LCDML_TYPE_default); // this menu function can be found on "LCDML_display_menuFunction" tab
// ***TIP*** Try to update _LCDML_DISP_cnt when you add a menu element.

@ -69,7 +69,6 @@ void lcdml_menu_control(void)
if(LCDML.CE_setup()) {
// runs only once
Serial.println("CE_setup()");
}
// check if new serial input is available

@ -48,15 +48,6 @@
LCDMenuLib2_menu LCDML_0 (255, 0, 0, NULL, NULL); // root menu element (do not change)
LCDMenuLib2 LCDML(LCDML_0, _LCDML_DISP_rows, _LCDML_DISP_cols, lcdml_menu_display, lcdml_menu_clear, lcdml_menu_control);
// *********************************************************************
// LCDML MENU/DISP
// *********************************************************************
// LCDML_0 => layer 0
// LCDML_0_X => layer 1
// LCDML_0_X_X => layer 2
// LCDML_0_X_X_X => layer 3
// LCDML_0_... => layer ...
// *********************************************************************
// LCDML MENU/DISP
// *********************************************************************
@ -89,7 +80,7 @@
// Example for one function and different parameters
// It is recommend to use parameters for switching settings like, (small drink, medium drink, big drink) or (200ml, 400ml, 600ml, 800ml) ...
// the parameter change can also be released with dynParams on the next example
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (16 , LCDML_0 , 5 , NULL, "Parameter" , NULL, 0, _LCDML_TYPE_default); // NULL = no menu function
LCDML_addAdvanced (17 , LCDML_0_5 , 1 , NULL, "Parameter 1" , mFunc_para, 10, _LCDML_TYPE_default); // NULL = no menu function
LCDML_addAdvanced (18 , LCDML_0_5 , 2 , NULL, "Parameter 2" , mFunc_para, 20, _LCDML_TYPE_default); // NULL = no menu function
@ -101,13 +92,13 @@
// 1. set the string to ""
// 2. use type _LCDML_TYPE_dynParam instead of _LCDML_TYPE_default
// this function type can not be used in combination with different parameters
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (21 , LCDML_0 , 6 , NULL, "" , mDyn_para, 0, _LCDML_TYPE_dynParam); // NULL = no menu function
// Example for conditions (for example for a screensaver)
// 1. define a condition as a function of a boolean type -> return false = not displayed, return true = displayed
// 2. set the function name as callback (remove the braces '()' it gives bad errors)
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (22 , LCDML_0 , 7 , COND_hide, "screensaver" , mFunc_screensaver, 0, _LCDML_TYPE_default); // this menu function can be found on "LCDML_display_menuFunction" tab
// ***TIP*** Try to update _LCDML_DISP_cnt when you add a menu element.

@ -69,7 +69,6 @@ void lcdml_menu_control(void)
if(LCDML.CE_setup()) {
// runs only once
Serial.println("CE_setup()");
}
// check if new serial input is available

@ -43,15 +43,6 @@
LCDMenuLib2_menu LCDML_0 (255, 0, 0, NULL, NULL); // root menu element (do not change)
LCDMenuLib2 LCDML(LCDML_0, _LCDML_DISP_rows, _LCDML_DISP_cols, lcdml_menu_display, lcdml_menu_clear, lcdml_menu_control);
// *********************************************************************
// LCDML MENU/DISP
// *********************************************************************
// LCDML_0 => layer 0
// LCDML_0_X => layer 1
// LCDML_0_X_X => layer 2
// LCDML_0_X_X_X => layer 3
// LCDML_0_... => layer ...
// *********************************************************************
// LCDML MENU/DISP
// *********************************************************************
@ -84,7 +75,7 @@
// Example for one function and different parameters
// It is recommend to use parameters for switching settings like, (small drink, medium drink, big drink) or (200ml, 400ml, 600ml, 800ml) ...
// the parameter change can also be released with dynParams on the next example
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (16 , LCDML_0 , 5 , NULL, "Parameter" , NULL, 0, _LCDML_TYPE_default); // NULL = no menu function
LCDML_addAdvanced (17 , LCDML_0_5 , 1 , NULL, "Parameter 1" , mFunc_para, 10, _LCDML_TYPE_default); // NULL = no menu function
LCDML_addAdvanced (18 , LCDML_0_5 , 2 , NULL, "Parameter 2" , mFunc_para, 20, _LCDML_TYPE_default); // NULL = no menu function
@ -96,13 +87,13 @@
// 1. set the string to ""
// 2. use type _LCDML_TYPE_dynParam instead of _LCDML_TYPE_default
// this function type can not be used in combination with different parameters
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (21 , LCDML_0 , 6 , NULL, "" , mDyn_para, 0, _LCDML_TYPE_dynParam); // NULL = no menu function
// Example for conditions (for example for a screensaver)
// 1. define a condition as a function of a boolean type -> return false = not displayed, return true = displayed
// 2. set the function name as callback (remove the braces '()' it gives bad errors)
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (22 , LCDML_0 , 7 , COND_hide, "screensaver" , mFunc_screensaver, 0, _LCDML_TYPE_default); // this menu function can be found on "LCDML_display_menuFunction" tab
// ***TIP*** Try to update _LCDML_DISP_cnt when you add a menu element.

@ -69,7 +69,6 @@ void lcdml_menu_control(void)
if(LCDML.CE_setup()) {
// runs only once
Serial.println("CE_setup()");
}
// check if new serial input is available

@ -27,7 +27,7 @@
// LCD object
// liquid crystal needs (rs, e, dat4, dat5, dat6, dat7)
LiquidCrystal lcd(2, 3, 8, 9, 10, 11);
LiquidCrystal lcd(22, 24, 9, 10, 11, 12);
const uint8_t scroll_bar[5][8] = {
{B10001, B10001, B10001, B10001, B10001, B10001, B10001, B10001}, // scrollbar top
@ -88,7 +88,7 @@
// Example for one function and different parameters
// It is recommend to use parameters for switching settings like, (small drink, medium drink, big drink) or (200ml, 400ml, 600ml, 800ml) ...
// the parameter change can also be released with dynParams on the next example
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (16 , LCDML_0 , 5 , NULL, "Parameter" , NULL, 0, _LCDML_TYPE_default); // NULL = no menu function
LCDML_addAdvanced (17 , LCDML_0_5 , 1 , NULL, "Parameter 1" , mFunc_para, 10, _LCDML_TYPE_default); // NULL = no menu function
LCDML_addAdvanced (18 , LCDML_0_5 , 2 , NULL, "Parameter 2" , mFunc_para, 20, _LCDML_TYPE_default); // NULL = no menu function
@ -100,20 +100,20 @@
// 1. set the string to ""
// 2. use type _LCDML_TYPE_dynParam instead of _LCDML_TYPE_default
// this function type can not be used in combination with different parameters
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (21 , LCDML_0 , 6 , NULL, "" , mDyn_para, 0, _LCDML_TYPE_dynParam); // NULL = no menu function
// 2. Example for dyn content
// add a function which have a upwards timer with seconds / minutes / hours
// the timer value is continuously updated
// the initscreentimer is disabled for this function
LCDML_addAdvanced (22 , LCDML_0 , 7 , NULL, "" , mDyn_time, 0, _LCDML_TYPE_dynParam); // NULL = no menu function
LCDML_addAdvanced (22 , LCDML_0 , 7 , NULL, "" , mDyn_time, 0, _LCDML_TYPE_dynParam_enableCustomRefresh); // NULL = no menu function
// Example for conditions (for example for a screensaver)
// 1. define a condition as a function of a boolean type -> return false = not displayed, return true = displayed
// 2. set the function name as callback (remove the braces '()' it gives bad errors)
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (23 , LCDML_0 , 8 , COND_hide, "screensaver" , mFunc_screensaver, 0, _LCDML_TYPE_default); // this menu function can be found on "LCDML_display_menuFunction" tab
// ***TIP*** Try to update _LCDML_DISP_cnt when you add a menu element.
@ -163,28 +163,28 @@
// special gobal variables for this example
boolean g_status_if_dyn_content_external_refresh_is_displayed = false;
unsigned long g_timer_1000ms = 0;
uint8_t dyn_hour = 0;
uint8_t dyn_min = 0;
uint8_t dyn_sec = 0;
boolean dyn_menu_is_displayed = false;
// *********************************************************************
// LOOP
// *********************************************************************
void loop()
{
{
// split loop() into loop_control() and loop_menu()
LCDML.loop_control();
LCDML.loop_control();
// add a counter (1000ms)
if(LCDML.TIMER_ms(g_timer_1000ms, 1000))
{
// only update the menu when a dynamic content function is called
// This variable is set in the LCDML_display_menu Tab on line 59/60
if(LCDML.MENU_checkDynContent() == true)
if(LCDML.MENU_checkDynRContent() == true)
{
LCDML.DISP_update();
LCDML.MENU_display();
}
// callculate a new value for the next update

@ -69,7 +69,6 @@ void lcdml_menu_control(void)
if(LCDML.CE_setup()) {
// runs only once
Serial.println("CE_setup()");
}
// check if new serial input is available

@ -62,13 +62,23 @@ void mDyn_para(uint8_t line)
}
}
// clear the line manuel because clear the complete content is disabled when a external refreshed function is active
lcd.setCursor(1, line);
for(uint8_t i=0;i<_LCDML_DISP_cols-3;i++) // -3 because:
// -1 for counter from 0 to x
// -1 for cursor position
// -1 for scrollbar on the end
{
lcd.print(F(" "));
}
char buf[20];
sprintf (buf, "dynValue: %d", g_dynParam);
// use the line from function parameters
lcd.setCursor(1, line);
lcd.print(buf);
}
@ -78,25 +88,31 @@ void mDyn_para(uint8_t line)
void mDyn_time(uint8_t line)
// *********************************************************************
{
// clear the line manuel because clear the complete content is disabled when a external refreshed function is active
lcd.setCursor(1, line);
for(uint8_t i=0;i<_LCDML_DISP_cols-3;i++) // -3 because:
// -1 for counter from 0 to x
// -1 for cursor position
// -1 for scrollbar on the end
{
lcd.print(F(" "));
}
char buf[20];
// http://www.c-howto.de/tutorial/benutzerinteraktion/bildschirmausgaben/
sprintf (buf, "%02d:%02d:%02d", dyn_hour, dyn_min, dyn_sec);
sprintf (buf, "Time %02d:%02d:%02d", dyn_hour, dyn_min, dyn_sec);
// use the line from function parameters
lcd.setCursor(1, line);
lcd.print(buf);
// reset initscreen timer when this function is displayed
LCDML.SCREEN_resetTimer();
//LCDML.SCREEN_resetTimer();
// check if this function is active (cursor stands on this line)
if (line == LCDML.MENU_getCursorPos())
{
// ...
// ...
}
}
}

@ -8,8 +8,11 @@
void lcdml_menu_clear()
/* ******************************************************************** */
{
lcd.clear();
lcd.setCursor(0, 0);
if (LCDML.MENU_checkDynRContent() == false)
{
// clear only the display when the external content refresh is not displayed
lcd.clear();
}
}
/* ******************************************************************** */
@ -19,11 +22,7 @@ void lcdml_menu_display()
// update content
// ***************
if (LCDML.DISP_checkMenuUpdate()) {
// clear menu
// ***************
LCDML.DISP_clear();
// declaration of some variables
// declaration of some variables
// ***************
// content variable
char content_text[_LCDML_DISP_cols]; // save the content text of every menu element
@ -32,10 +31,11 @@ void lcdml_menu_display()
// some limit values
uint8_t i = LCDML.MENU_getScroll();
uint8_t maxi = _LCDML_DISP_rows + i;
uint8_t n = 0;
// reset a state
dyn_menu_is_displayed = false;
uint8_t n = 0;
// clear menu
// ***************
LCDML.DISP_clear();
// check if this element has children
if ((tmp = LCDML.MENU_getDisplayedObj()) != NULL)
@ -57,9 +57,7 @@ void lcdml_menu_display()
else
{
if(tmp->checkType_dynParam())
{
// call a dyn content element
LCDML.MENU_setDynContent();
{
tmp->callback(n);
}
}
@ -70,6 +68,8 @@ void lcdml_menu_display()
// try to go to the next sibling and check the number of displayed rows
} while (((tmp = tmp->getSibling(1)) != NULL) && (i < maxi));
}
}
if(LCDML.DISP_checkMenuCursorUpdate())
@ -91,6 +91,10 @@ void lcdml_menu_display()
//set cursor char
if (n == LCDML.MENU_getCursorPos()) {
lcd.write(_LCDML_DISP_cfg_cursor);
if(LCDML.MENU_checkDynRContent() == true)
{
LCDML.MENU_getDisplayedObj()->callback(n);
}
} else {
lcd.write(' ');
}
@ -128,4 +132,4 @@ void lcdml_menu_display()
}
}
}
}
}

@ -45,15 +45,6 @@
LCDMenuLib2_menu LCDML_0 (255, 0, 0, NULL, NULL); // root menu element (do not change)
LCDMenuLib2 LCDML(LCDML_0, _LCDML_DISP_rows, _LCDML_DISP_cols, lcdml_menu_display, lcdml_menu_clear, lcdml_menu_control);
// *********************************************************************
// LCDML MENU/DISP
// *********************************************************************
// LCDML_0 => layer 0
// LCDML_0_X => layer 1
// LCDML_0_X_X => layer 2
// LCDML_0_X_X_X => layer 3
// LCDML_0_... => layer ...
// *********************************************************************
// LCDML MENU/DISP
// *********************************************************************
@ -119,7 +110,7 @@
// Example for one function and different parameters
// It is recommend to use parameters for switching settings like, (small drink, medium drink, big drink) or (200ml, 400ml, 600ml, 800ml) ...
// the parameter change can also be released with dynParams on the next example
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (16 , LCDML_0 , 5 , NULL, "Parameter" , NULL, 0, _LCDML_TYPE_default); // NULL = no menu function
LCDML_langDef (16, DE, "Parameter");
@ -139,7 +130,7 @@
// 1. set the string to ""
// 2. use type _LCDML_TYPE_dynParam instead of _LCDML_TYPE_default
// this function type can not be used in combination with different parameters
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (21 , LCDML_0 , 6 , NULL, "" , mDyn_para, 0, _LCDML_TYPE_dynParam); // NULL = no menu function
LCDML_langDef (21, DE, "");
@ -147,7 +138,7 @@
// Example for conditions (for example for a screensaver)
// 1. define a condition as a function of a boolean type -> return false = not displayed, return true = displayed
// 2. set the function name as callback (remove the braces '()' it gives bad errors)
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (22 , LCDML_0 , 7 , COND_hide, "" , mFunc_screensaver, 0, _LCDML_TYPE_default); // this menu function can be found on "LCDML_display_menuFunction" tab
LCDML_langDef (22, DE, "");

@ -69,7 +69,6 @@ void lcdml_menu_control(void)
if(LCDML.CE_setup()) {
// runs only once
Serial.println("CE_setup()");
}
// check if new serial input is available

@ -69,7 +69,6 @@ void lcdml_menu_control(void)
if(LCDML.CE_setup()) {
// runs only once
Serial.println("CE_setup()");
}
// check if new serial input is available

@ -55,9 +55,6 @@
// LCDML_0_X_X_X => layer 3
// LCDML_0_... => layer ...
// For beginners
// LCDML_add(id, prev_layer, new_num, lang_char_array, callback_function)
LCDML_add (0 , LCDML_0 , 1 , "Information" , mFunc_information); // this menu function can be found on "LCDML_display_menuFunction" tab
@ -73,13 +70,13 @@
// 1. set the string to ""
// 2. use type _LCDML_TYPE_dynParam instead of _LCDML_TYPE_default
// this function type can not be used in combination with different parameters
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (8 , LCDML_0 , 5 , NULL, "" , mDyn_change_condetion, 0, _LCDML_TYPE_dynParam); // NULL = no menu function
// Example for conditions (for example for a screensaver)
// 1. define a condition as a function of a boolean type -> return false = not displayed, return true = displayed
// 2. set the function name as callback (remove the braces '()' it gives bad errors)
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (9 , LCDML_0 , 6 , COND_hide, "screensaver" , mFunc_screensaver, 0, _LCDML_TYPE_default); // this menu function can be found on "LCDML_display_menuFunction" tab

@ -69,7 +69,6 @@ void lcdml_menu_control(void)
if(LCDML.CE_setup()) {
// runs only once
Serial.println("CE_setup()");
}
// check if new serial input is available

@ -69,7 +69,6 @@ void lcdml_menu_control(void)
if(LCDML.CE_setup()) {
// runs only once
Serial.println("CE_setup()");
}
// check if new serial input is available

@ -94,7 +94,7 @@
// Example for one function and different parameters
// It is recommend to use parameters for switching settings like, (small drink, medium drink, big drink) or (200ml, 400ml, 600ml, 800ml) ...
// the parameter change can also be released with dynParams on the next example
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (16 , LCDML_0 , 5 , NULL, "Parameter" , NULL, 0, _LCDML_TYPE_default); // NULL = no menu function
LCDML_addAdvanced (17 , LCDML_0_5 , 1 , NULL, "Parameter 1" , mFunc_para, 10, _LCDML_TYPE_default); // NULL = no menu function
LCDML_addAdvanced (18 , LCDML_0_5 , 2 , NULL, "Parameter 2" , mFunc_para, 20, _LCDML_TYPE_default); // NULL = no menu function
@ -106,13 +106,13 @@
// 1. set the string to ""
// 2. use type _LCDML_TYPE_dynParam instead of _LCDML_TYPE_default
// this function type can not be used in combination with different parameters
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (21 , LCDML_0 , 6 , NULL, "" , mDyn_para, 0, _LCDML_TYPE_dynParam); // NULL = no menu function
// Example for conditions (for example for a screensaver)
// 1. define a condition as a function of a boolean type -> return false = not displayed, return true = displayed
// 2. set the function name as callback (remove the braces '()' it gives bad errors)
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (22 , LCDML_0 , 7 , COND_hide, "screensaver" , mFunc_screensaver, 0, _LCDML_TYPE_default); // this menu function can be found on "LCDML_display_menuFunction" tab
// ***TIP*** Try to update _LCDML_DISP_cnt when you add a menu element.

@ -69,7 +69,6 @@ void lcdml_menu_control(void)
if(LCDML.CE_setup()) {
// runs only once
Serial.println("CE_setup()");
}
// check if new serial input is available

@ -1,7 +1,7 @@
// ============================================================
// Example: LCDML: graphic display with u8g
// ============================================================
// Author: Nils Feldkämper
// Author: Jomelo
// Last update: 21.01.2018
// License: MIT
// ============================================================
@ -119,7 +119,7 @@
// Example for one function and different parameters
// It is recommend to use parameters for switching settings like, (small drink, medium drink, big drink) or (200ml, 400ml, 600ml, 800ml) ...
// the parameter change can also be released with dynParams on the next example
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (16 , LCDML_0 , 5 , NULL, "Parameter" , NULL, 0, _LCDML_TYPE_default); // NULL = no menu function
LCDML_addAdvanced (17 , LCDML_0_5 , 1 , NULL, "Parameter 1" , mFunc_para, 10, _LCDML_TYPE_default); // NULL = no menu function
LCDML_addAdvanced (18 , LCDML_0_5 , 2 , NULL, "Parameter 2" , mFunc_para, 20, _LCDML_TYPE_default); // NULL = no menu function
@ -131,13 +131,13 @@
// 1. set the string to ""
// 2. use type _LCDML_TYPE_dynParam instead of _LCDML_TYPE_default
// this function type can not be used in combination with different parameters
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (21 , LCDML_0 , 6 , NULL, "" , mDyn_para, 0, _LCDML_TYPE_dynParam); // NULL = no menu function
// Example for conditions (for example for a screensaver)
// 1. define a condition as a function of a boolean type -> return false = not displayed, return true = displayed
// 2. set the function name as callback (remove the braces '()' it gives bad errors)
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (22 , LCDML_0 , 7 , COND_hide, "screensaver" , mFunc_screensaver, 0, _LCDML_TYPE_default); // this menu function can be found on "LCDML_display_menuFunction" tab
// ***TIP*** Try to update _LCDML_DISP_cnt when you add a menu element.

@ -69,7 +69,6 @@ void lcdml_menu_control(void)
if(LCDML.CE_setup()) {
// runs only once
Serial.println("CE_setup()");
}
// check if new serial input is available

@ -1,7 +1,7 @@
// ============================================================
// Example: LCDML: graphic display with u8g
// ============================================================
// Author: Nils Feldkämper
// Author: Jomelo
// Last update: 21.01.2018
// License: MIT
// ============================================================
@ -108,7 +108,7 @@
// Example for one function and different parameters
// It is recommend to use parameters for switching settings like, (small drink, medium drink, big drink) or (200ml, 400ml, 600ml, 800ml) ...
// the parameter change can also be released with dynParams on the next example
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (16 , LCDML_0 , 5 , NULL, "Parameter" , NULL, 0, _LCDML_TYPE_default); // NULL = no menu function
LCDML_addAdvanced (17 , LCDML_0_5 , 1 , NULL, "Parameter 1" , mFunc_para, 10, _LCDML_TYPE_default); // NULL = no menu function
LCDML_addAdvanced (18 , LCDML_0_5 , 2 , NULL, "Parameter 2" , mFunc_para, 20, _LCDML_TYPE_default); // NULL = no menu function
@ -120,13 +120,13 @@
// 1. set the string to ""
// 2. use type _LCDML_TYPE_dynParam instead of _LCDML_TYPE_default
// this function type can not be used in combination with different parameters
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (21 , LCDML_0 , 6 , NULL, "" , mDyn_para, 0, _LCDML_TYPE_dynParam); // NULL = no menu function
// Example for conditions (for example for a screensaver)
// 1. define a condition as a function of a boolean type -> return false = not displayed, return true = displayed
// 2. set the function name as callback (remove the braces '()' it gives bad errors)
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (22 , LCDML_0 , 7 , COND_hide, "screensaver" , mFunc_screensaver, 0, _LCDML_TYPE_default); // this menu function can be found on "LCDML_display_menuFunction" tab
// ***TIP*** Try to update _LCDML_DISP_cnt when you add a menu element.

@ -69,7 +69,6 @@ void lcdml_menu_control(void)
if(LCDML.CE_setup()) {
// runs only once
Serial.println("CE_setup()");
}
// check if new serial input is available

@ -1,7 +1,7 @@
// ============================================================
// Example: LCDML: use ADAFRUIT i2c display ssd1306
// ============================================================
// Author: Nils Feldkämper
// Author: Jomelo
// Last update: 12.11.2018
// License: MIT
// ============================================================
@ -44,9 +44,7 @@
// settings for u8g lib and lcd
#define _LCDML_ADAFRUIT_lcd_w 128 // lcd width
#define _LCDML_ADAFRUIT_lcd_h 64 // lcd height
#define OLED_RESET 4 // not used / nicht genutzt bei diesem Display
Adafruit_SSD1306 display(OLED_RESET);
@ -117,7 +115,7 @@
// Example for one function and different parameters
// It is recommend to use parameters for switching settings like, (small drink, medium drink, big drink) or (200ml, 400ml, 600ml, 800ml) ...
// the parameter change can also be released with dynParams on the next example
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (16 , LCDML_0 , 5 , NULL, "Parameter" , NULL, 0, _LCDML_TYPE_default); // NULL = no menu function
LCDML_addAdvanced (17 , LCDML_0_5 , 1 , NULL, "Parameter 1" , mFunc_para, 10, _LCDML_TYPE_default); // NULL = no menu function
LCDML_addAdvanced (18 , LCDML_0_5 , 2 , NULL, "Parameter 2" , mFunc_para, 20, _LCDML_TYPE_default); // NULL = no menu function
@ -129,13 +127,13 @@
// 1. set the string to ""
// 2. use type _LCDML_TYPE_dynParam instead of _LCDML_TYPE_default
// this function type can not be used in combination with different parameters
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (21 , LCDML_0 , 6 , NULL, "" , mDyn_para, 0, _LCDML_TYPE_dynParam); // NULL = no menu function
// Example for conditions (for example for a screensaver)
// 1. define a condition as a function of a boolean type -> return false = not displayed, return true = displayed
// 2. set the function name as callback (remove the braces '()' it gives bad errors)
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (22 , LCDML_0 , 7 , COND_hide, "screensaver" , mFunc_screensaver, 0, _LCDML_TYPE_default); // this menu function can be found on "LCDML_display_menuFunction" tab
// ***TIP*** Try to update _LCDML_DISP_cnt when you add a menu element.

@ -0,0 +1,646 @@
// =====================================================================
//
// CONTROL v2.2.0
//
// =====================================================================
// *********************************************************************
// Features
// - max 6 Buttons with special names (enter, quit, up, down, left, right)
// new Features on v2.2.0
// - max 64 Events, this could be a button ore something (Counter 0 - 63)
// - standard buttons and events can be used at the same time
// - Event 0 - 3 can be used with a menu callback function (when set this event, the function is called)
// - The range from 0 - 3 can be changed in LCDMenuLib2.h
// Attention!!
// - events have to be reset manual over LCDML.CE_reset(number) ore LCDML.CE_resetAll();
// - they will not be reseted from the menu library
// *********************************************************************
// content:
// (0) Control over serial interface with asdw_e_q
// (1) Control over one analog input
// (2) Control over 4 - 6 digital input pins (internal pullups enabled)
// (3) Control over encoder [third party lib] (Download: https://github.com/PaulStoffregen/Encoder)
// (4) Control with Keypad [third party lib] (Download: http://playground.arduino.cc/Main/KeypadTutorial )
// (5) Control with an IRMP remote [third party lib] (Download: https://github.com/ukw100/IRMP )
// (6) Control with a joystick
// (7) Control over I2C PCF8574
// *********************************************************************
#define _LCDML_CONTROL_cfg 0
// theory:
// "#if" is a preprocessor directive and no error, look here:
// (English) https://en.wikipedia.org/wiki/C_preprocessor
// (German) https://de.wikipedia.org/wiki/C-Pr%C3%A4prozessor
// *********************************************************************
// *************** (0) CONTROL OVER SERIAL INTERFACE *******************
// *********************************************************************
#if(_LCDML_CONTROL_cfg == 0)
// settings
# define _LCDML_CONTROL_serial_enter 'e'
# define _LCDML_CONTROL_serial_up 'w'
# define _LCDML_CONTROL_serial_down 's'
# define _LCDML_CONTROL_serial_left 'a'
# define _LCDML_CONTROL_serial_right 'd'
# define _LCDML_CONTROL_serial_quit 'q'
// example for the useage of events (not needed everywhere)
// this defines are only for examples and can be renamed
# define _LCDML_EVENT_command 'c'
# define _LCDML_EVENT_char_0 '0'
# define _LCDML_EVENT_char_1 '1'
# define _LCDML_EVENT_char_2 '2'
# define _LCDML_EVENT_char_3 '3'
# define _LCDML_EVENT_char_4 '4'
# define _LCDML_EVENT_char_5 '5'
# define _LCDML_EVENT_char_6 '6'
# define _LCDML_EVENT_char_7 '7'
# define _LCDML_EVENT_char_8 '8'
# define _LCDML_EVENT_char_9 '9'
// *********************************************************************
void lcdml_menu_control(void)
{
// If something must init, put in in the setup condition
if(LCDML.BT_setup()) {
// runs only once
}
if(LCDML.CE_setup()) {
// runs only once
}
// check if new serial input is available
if (Serial.available()) {
// read one char from input buffer
switch (Serial.read())
{
case _LCDML_CONTROL_serial_enter: LCDML.BT_enter(); break;
case _LCDML_CONTROL_serial_up: LCDML.BT_up(); break;
case _LCDML_CONTROL_serial_down: LCDML.BT_down(); break;
case _LCDML_CONTROL_serial_left: LCDML.BT_left(); break;
case _LCDML_CONTROL_serial_right: LCDML.BT_right(); break;
case _LCDML_CONTROL_serial_quit: LCDML.BT_quit(); break;
// example for event handling
// custom event handling
// is is also possible to enable more the one event on the same time
// but when more then one events with callback functions are active
// only the first callback function is called. (first = by number)
case _LCDML_EVENT_command: LCDML.CE_set(0); break;
case _LCDML_EVENT_char_0: LCDML.CE_set(1); break;
case _LCDML_EVENT_char_1: LCDML.CE_set(2); break;
case _LCDML_EVENT_char_2: LCDML.CE_set(3); break;
case _LCDML_EVENT_char_3: LCDML.CE_set(4); break;
case _LCDML_EVENT_char_4: LCDML.CE_set(5); break;
case _LCDML_EVENT_char_5: LCDML.CE_set(6); break;
case _LCDML_EVENT_char_6: LCDML.CE_set(7); break;
case _LCDML_EVENT_char_7: LCDML.CE_set(8); break;
case _LCDML_EVENT_char_8: LCDML.CE_set(9); break;
case _LCDML_EVENT_char_9: LCDML.CE_set(10); break;
default: break;
}
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
// *********************************************************************
// *************** (1) CONTROL OVER ONE ANALOG PIN *********************
// *********************************************************************
#elif(_LCDML_CONTROL_cfg == 1)
unsigned long g_LCDML_DISP_press_time = 0;
// settings
#define _LCDML_CONTROL_analog_pin 0
// when you did not use a button set the value to zero
#define _LCDML_CONTROL_analog_enter_min 850 // Button Enter
#define _LCDML_CONTROL_analog_enter_max 920
#define _LCDML_CONTROL_analog_up_min 520 // Button Up
#define _LCDML_CONTROL_analog_up_max 590
#define _LCDML_CONTROL_analog_down_min 700 // Button Down
#define _LCDML_CONTROL_analog_down_max 770
#define _LCDML_CONTROL_analog_back_min 950 // Button Back
#define _LCDML_CONTROL_analog_back_max 1020
#define _LCDML_CONTROL_analog_left_min 430 // Button Left
#define _LCDML_CONTROL_analog_left_max 500
#define _LCDML_CONTROL_analog_right_min 610 // Button Right
#define _LCDML_CONTROL_analog_right_max 680
// *********************************************************************
void lcdml_menu_control(void)
{
// If something must init, put in in the setup condition
if(LCDML.BT_setup()) {
// runs only once
}
// check debounce timer
if((millis() - g_LCDML_DISP_press_time) >= 200) {
g_LCDML_DISP_press_time = millis(); // reset debounce timer
uint16_t value = analogRead(_LCDML_CONTROL_analog_pin); // analog pin for keypad
if (value >= _LCDML_CONTROL_analog_enter_min && value <= _LCDML_CONTROL_analog_enter_max) { LCDML.BT_enter(); }
if (value >= _LCDML_CONTROL_analog_up_min && value <= _LCDML_CONTROL_analog_up_max) { LCDML.BT_up(); }
if (value >= _LCDML_CONTROL_analog_down_min && value <= _LCDML_CONTROL_analog_down_max) { LCDML.BT_down(); }
if (value >= _LCDML_CONTROL_analog_left_min && value <= _LCDML_CONTROL_analog_left_max) { LCDML.BT_left(); }
if (value >= _LCDML_CONTROL_analog_right_min && value <= _LCDML_CONTROL_analog_right_max) { LCDML.BT_right(); }
if (value >= _LCDML_CONTROL_analog_back_min && value <= _LCDML_CONTROL_analog_back_max) { LCDML.BT_quit(); }
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
// *********************************************************************
// *************** (2) CONTROL OVER DIGITAL PINS ***********************
// *********************************************************************
#elif(_LCDML_CONTROL_cfg == 2)
// settings
unsigned long g_LCDML_DISP_press_time = 0;
#define _LCDML_CONTROL_digital_low_active 0 // 0 = high active (pulldown) button, 1 = low active (pullup)
// http://playground.arduino.cc/CommonTopics/PullUpDownResistor
#define _LCDML_CONTROL_digital_enable_quit 1
#define _LCDML_CONTROL_digital_enable_lr 1
#define _LCDML_CONTROL_digital_enter 8
#define _LCDML_CONTROL_digital_up 9
#define _LCDML_CONTROL_digital_down 10
#define _LCDML_CONTROL_digital_quit 11
#define _LCDML_CONTROL_digital_left 12
#define _LCDML_CONTROL_digital_right 13
// *********************************************************************
void lcdml_menu_control(void)
{
// If something must init, put in in the setup condition
if(LCDML.BT_setup()) {
// runs only once
// init buttons
pinMode(_LCDML_CONTROL_digital_enter , INPUT_PULLUP);
pinMode(_LCDML_CONTROL_digital_up , INPUT_PULLUP);
pinMode(_LCDML_CONTROL_digital_down , INPUT_PULLUP);
# if(_LCDML_CONTROL_digital_enable_quit == 1)
pinMode(_LCDML_CONTROL_digital_quit , INPUT_PULLUP);
# endif
# if(_LCDML_CONTROL_digital_enable_lr == 1)
pinMode(_LCDML_CONTROL_digital_left , INPUT_PULLUP);
pinMode(_LCDML_CONTROL_digital_right , INPUT_PULLUP);
# endif
}
#if(_LCDML_CONTROL_digital_low_active == 1)
# define _LCDML_CONTROL_digital_a !
#else
# define _LCDML_CONTROL_digital_a
#endif
uint8_t but_stat = 0x00;
bitWrite(but_stat, 0, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_enter)));
bitWrite(but_stat, 1, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_up)));
bitWrite(but_stat, 2, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_down)));
#if(_LCDML_CONTROL_digital_enable_quit == 1)
bitWrite(but_stat, 3, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_quit)));
#endif
#if(_LCDML_CONTROL_digital_enable_lr == 1)
bitWrite(but_stat, 4, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_left)));
bitWrite(but_stat, 5, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_right)));
#endif
if (but_stat > 0) {
if((millis() - g_LCDML_DISP_press_time) >= 200) {
g_LCDML_DISP_press_time = millis(); // reset press time
if (bitRead(but_stat, 0)) { LCDML.BT_enter(); }
if (bitRead(but_stat, 1)) { LCDML.BT_up(); }
if (bitRead(but_stat, 2)) { LCDML.BT_down(); }
if (bitRead(but_stat, 3)) { LCDML.BT_quit(); }
if (bitRead(but_stat, 4)) { LCDML.BT_left(); }
if (bitRead(but_stat, 5)) { LCDML.BT_right(); }
}
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
// *********************************************************************
// *************** (3) CONTROL WITH ENCODER ****************************
// *********************************************************************
#elif(_LCDML_CONTROL_cfg == 3)
/*
* Thanks to "MuchMore" (Arduino forum) to add this encoder functionality
*
* rotate left = Up
* rotate right = Down
* push = Enter
* push long = Quit
* push + rotate left = Left
* push + rotate right = Right
*/
/* encoder connection
* button * (do not use an external resistor, the internal pullup resistor is used)
* .-------o Arduino Pin
* |
* |
* o /
* /
* /
* o
* |
* '-------o GND
*
* encoder * (do not use an external resistor, the internal pullup resistors are used)
*
* .---------------o Arduino Pin A
* | .------o Arduino Pin B
* | |
* o / o /
* / /
* / /
* o o
* | |
* '--------o----o GND (common pin)
*/
// global defines
#define encoder_A_pin 20 // physical pin has to be 2 or 3 to use interrupts (on mega e.g. 20 or 21), use internal pullups
#define encoder_B_pin 21 // physical pin has to be 2 or 3 to use interrupts (on mega e.g. 20 or 21), use internal pullups
#define encoder_button_pin 49 // physical pin , use internal pullup
#define g_LCDML_CONTROL_button_long_press 800 // ms
#define g_LCDML_CONTROL_button_short_press 120 // ms
#define ENCODER_OPTIMIZE_INTERRUPTS //Only when using pin2/3 (or 20/21 on mega)
#include <Encoder.h> //for Encoder Download: https://github.com/PaulStoffregen/Encoder
Encoder ENCODER(encoder_A_pin, encoder_B_pin);
unsigned long g_LCDML_CONTROL_button_press_time = millis();
bool g_LCDML_CONTROL_button_prev = HIGH;
// *********************************************************************
void lcdml_menu_control(void)
// *********************************************************************
{
// declare variable for this function
int32_t g_LCDML_CONTROL_Encoder_position = ENCODER.read();
bool g_LCDML_button = digitalRead(encoder_button_pin);
// If something must init, put in in the setup condition
if(LCDML.BT_setup())
{
// runs only once
// init pins, enable pullups
pinMode(encoder_A_pin , INPUT_PULLUP);
pinMode(encoder_B_pin , INPUT_PULLUP);
pinMode(encoder_button_pin , INPUT_PULLUP);
}
// check if encoder is rotated on direction A
if(g_LCDML_CONTROL_Encoder_position <= -3)
{
// check if the button is pressed and the encoder is rotated
// the button is low active
if(g_LCDML_button == LOW)
{
// button is pressed
LCDML.BT_left();
// reset button press time for next detection
g_LCDML_CONTROL_button_prev = HIGH;
}
else
{
LCDML.BT_down();
}
// init encoder for the next step
ENCODER.write(g_LCDML_CONTROL_Encoder_position+4);
}
// check if encoder is rotated on direction B
else if(g_LCDML_CONTROL_Encoder_position >= 3)
{
// check if the button is pressed and the encoder is rotated
// the button is low active
if(g_LCDML_button == LOW)
{
// button is pressed
LCDML.BT_right();
// reset button press time for next detection
g_LCDML_CONTROL_button_prev = HIGH;
}
else
{
LCDML.BT_up();
}
// init encoder for the next step
ENCODER.write(g_LCDML_CONTROL_Encoder_position-4);
}
else
{
// check if the button was pressed for a shortly time or a long time
//falling edge, button pressed, no action
if(g_LCDML_button == LOW && g_LCDML_CONTROL_button_prev == HIGH)
{
g_LCDML_CONTROL_button_prev = LOW;
g_LCDML_CONTROL_button_press_time = millis();
}
// rising edge, button not pressed, check how long was it pressed
else if(g_LCDML_button == HIGH && g_LCDML_CONTROL_button_prev == LOW)
{
g_LCDML_CONTROL_button_prev = HIGH;
// check how long was the button pressed and detect a long press or a short press
// check long press situation
if((millis() - g_LCDML_CONTROL_button_press_time) >= g_LCDML_CONTROL_button_long_press)
{
// long press detected
LCDML.BT_quit();
}
// check short press situation
else if((millis() - g_LCDML_CONTROL_button_press_time) >= g_LCDML_CONTROL_button_short_press)
{
// short press detected
LCDML.BT_enter();
}
}
// do nothing
else
{
// do nothing
}
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
// *********************************************************************
// *************** (4) CONTROL WITH A KEYPAD ***************************
// *********************************************************************
#elif(_LCDML_CONTROL_cfg == 4)
// include
// more information under http://playground.arduino.cc/Main/KeypadTutorial
#include <Keypad.h>
// settings
#define _LCDML_CONTROL_keypad_rows 4 // Four rows
#define _LCDML_CONTROL_keypad_cols 3 // Three columns
// global vars
char keys[_LCDML_CONTROL_keypad_rows][_LCDML_CONTROL_keypad_cols] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'#','0','*'}
};
byte rowPins[_LCDML_CONTROL_keypad_rows] = { 9, 8, 7, 6 }; // Connect keypad COL0, COL1 and COL2 to these Arduino pins.
byte colPins[_LCDML_CONTROL_keypad_cols] = { 12, 11, 10 }; // Create the Keypad
// objects
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, _LCDML_CONTROL_keypad_rows, _LCDML_CONTROL_keypad_cols );
// *********************************************************************
void lcdml_menu_control(void)
{
// If something must init, put in in the setup condition
if(LCDML.BT_setup()) {
// runs only once
}
char key = kpd.getKey();
if(key) // Check for a valid key.
{
switch (key)
{
// this is the default configuration
case '#': LCDML.BT_enter(); break;
case '2': LCDML.BT_up(); break;
case '8': LCDML.BT_down(); break;
case '4': LCDML.BT_left(); break;
case '6': LCDML.BT_right(); break;
case '*': LCDML.BT_quit(); break;
// when you want to use all characters you have to use the CE_ functionality
// CE stands for "custom event" and you can define 64 evetns
// the following code is only an example
/*
case '1': LCDML.CE_set(2); break;
case '2': LCDML.CE_set(3); LCDML.BT_up(); break;
case '3': LCDML.CE_set(4); break;
case '4': LCDML.CE_set(5); LCDML.BT_left(); break;
case '5': LCDML.CE_set(6); break;
case '6': LCDML.CE_set(7); LCDML.BT_right(); break;
case '7': LCDML.CE_set(8); break;
case '8': LCDML.CE_set(9); LCDML.BT_down(); break;
case '9': LCDML.CE_set(10); break;
case '0': LCDML.CE_set(1); break;
case '#': LCDML.CE_set(12); LCDML.BT_enter(); break;
case '*': LCDML.CE_set(11); LCDML.BT_quit(); break;
*/
default: break;
}
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
// *********************************************************************
// *************** (5) CONTROL WITH IR REMOTE ***************************
// *********************************************************************
#elif(_LCDML_CONTROL_cfg == 5)
// IR include (this lib have to be installed)
// Download path: https://github.com/ukw100/IRMP
#define IRMP_INPUT_PIN PA0
#define IRMP_PROTOCOL_NAMES 1 // Enable protocol number mapping to protocol strings - needs some FLASH. Must before #include <irmp*>
#include <irmpSelectMain15Protocols.h> // This enables 15 main protocols
#include <irmp.c.h>
IRMP_DATA irmp_data[1];
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
void handleReceivedIRData();
// *********************************************************************
// change in this function the IR values to your values
void lcdml_menu_control(void)
{
// If something must init, put in in the setup condition
if(LCDML.BT_setup()) {
// runs only once
irmp_init();
}
if (irmp_get_data(&irmp_data[0]))
{
// comment this line out, to check the correct code
//Serial.println(results.value, HEX);
// in this switch case you have to change the value 0x...1 to the correct IR code
switch (irmp_data[0].command)
{
case 0x52: LCDML.BT_enter(); break;
case 0x50: LCDML.BT_up(); break;
case 0x51: LCDML.BT_down(); break;
case 0x55: LCDML.BT_left(); break;
case 0x56: LCDML.BT_right(); break;
case 0x23: LCDML.BT_quit(); break;
default: break;
}
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
// *********************************************************************
// *************** (6) CONTROL OVER JOYSTICK ***************************
// *********************************************************************
#elif(_LCDML_CONTROL_cfg == 6)
unsigned long g_LCDML_DISP_press_time = 0;
// settings
#define _LCDML_CONTROL_analog_pinx A0
#define _LCDML_CONTROL_analog_piny A1
#define _LCDML_CONTROL_digitalread 33 //don't work with u8glib
// when you did not use a button set the value to zero
#define _LCDML_CONTROL_analog_up_min 612 // Button Up
#define _LCDML_CONTROL_analog_up_max 1023
#define _LCDML_CONTROL_analog_down_min 0 // Button Down
#define _LCDML_CONTROL_analog_down_max 412
#define _LCDML_CONTROL_analog_left_min 612 // Button Left
#define _LCDML_CONTROL_analog_left_max 1023
#define _LCDML_CONTROL_analog_right_min 0 // Button Right
#define _LCDML_CONTROL_analog_right_max 412
// *********************************************************************
void lcdml_menu_control(void)
{
// If something must init, put in in the setup condition
if(LCDML.BT_setup()) {
// runs only once
pinMode (_LCDML_CONTROL_digitalread, INPUT);
}
// check debounce timer
if((millis() - g_LCDML_DISP_press_time) >= 200) {
g_LCDML_DISP_press_time = millis(); // reset debounce timer
uint16_t valuex = analogRead(_LCDML_CONTROL_analog_pinx); // analogpinx
uint16_t valuey = analogRead(_LCDML_CONTROL_analog_piny); // analogpinx
uint16_t valuee = digitalRead(_LCDML_CONTROL_digitalread); //digitalpinenter
if (valuey >= _LCDML_CONTROL_analog_up_min && valuey <= _LCDML_CONTROL_analog_up_max) { LCDML.BT_up(); } // up
if (valuey >= _LCDML_CONTROL_analog_down_min && valuey <= _LCDML_CONTROL_analog_down_max) { LCDML.BT_down(); } // down
if (valuex >= _LCDML_CONTROL_analog_left_min && valuex <= _LCDML_CONTROL_analog_left_max) { LCDML.BT_left(); } // left
if (valuex >= _LCDML_CONTROL_analog_right_min && valuex <= _LCDML_CONTROL_analog_right_max) { LCDML.BT_right(); } // right
if(valuee == true) {LCDML.BT_enter();} // enter
// back buttons have to be included as menu item
// lock at the example LCDML_back_button
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
// *********************************************************************
// *************** (7) CONTROL OVER PCF8574 ****************************
// *********************************************************************
#elif(_LCDML_CONTROL_cfg == 7)
unsigned long g_LCDML_DISP_press_time = 0;
#define PCF8574_1 0x26 // I2C address for the buttons
#define PCF8574_Pin0 254
#define PCF8574_Pin1 253
#define PCF8574_Pin2 251
#define PCF8574_Pin3 247
#define PCF8574_Pin4 239
#define PCF8574_Pin5 223
#define PCF8574_Pin6 191
#define PCF8574_Pin7 127
// Specify the PCF8574 pins here
#define _LCDML_CONTROL_PCF8574_enable_quit 0
#define _LCDML_CONTROL_PCF8574_enable_lr 0
#define _LCDML_CONTROL_PCF8574_enter PCF8574_Pin0
#define _LCDML_CONTROL_PCF8574_up PCF8574_Pin1
#define _LCDML_CONTROL_PCF8574_down PCF8574_Pin2
#define _LCDML_CONTROL_PCF8574_left PCF8574_Pin3
#define _LCDML_CONTROL_PCF8574_right PCF8574_Pin4
#define _LCDML_CONTROL_PCF8574_quit PCF8574_Pin5
// **********************************************************
void lcdml_menu_control(void)
{
// If something must init, put in in the setup condition
if(LCDML.BT_setup()) {
// runs only once
}
if((millis() - g_LCDML_DISP_press_time) >= 200) {
g_LCDML_DISP_press_time = millis(); // reset press time
Wire.write(0xff); // All pins as input?
Wire.requestFrom(PCF8574_1, 1);
if (Wire.available()) {
switch (Wire.read())
{
case _LCDML_CONTROL_PCF8574_enter: LCDML.BT_enter(); break;
case _LCDML_CONTROL_PCF8574_up: LCDML.BT_up(); break;
case _LCDML_CONTROL_PCF8574_down: LCDML.BT_down(); break;
#if(_LCDML_CONTROL_PCF8574_enable_quit == 1)
case _LCDML_CONTROL_PCF8574_quit: LCDML.BT_quit(); break;
#endif
#if(_LCDML_CONTROL_PCF8574_enable_lr == 1)
case _LCDML_CONTROL_PCF8574_left: LCDML.BT_left(); break;
case _LCDML_CONTROL_PCF8574_right: LCDML.BT_right(); break;
#endif
default: break;
}
}
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
#else
#error _LCDML_CONTROL_cfg is not defined or not in range
#endif

@ -1,7 +1,7 @@
// ============================================================
// Example: LCDML: use ADAFRUIT i2c display ssd1306
// ============================================================
// Author: Nils Feldkämper, Markus Rudel
// Author: Jomelo, Markus Rudel
// Last update: 12.11.2018
// License: MIT
// ============================================================
@ -126,7 +126,7 @@
// Example for one function and different parameters
// It is recommend to use parameters for switching settings like, (small drink, medium drink, big drink) or (200ml, 400ml, 600ml, 800ml) ...
// the parameter change can also be released with dynParams on the next example
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (16 , LCDML_0 , 5 , NULL, "Parameter" , NULL, 0, _LCDML_TYPE_default); // NULL = no menu function
LCDML_addAdvanced (17 , LCDML_0_5 , 1 , NULL, "Parameter 1" , mFunc_para, 10, _LCDML_TYPE_default); // NULL = no menu function
LCDML_addAdvanced (18 , LCDML_0_5 , 2 , NULL, "Parameter 2" , mFunc_para, 20, _LCDML_TYPE_default); // NULL = no menu function
@ -138,7 +138,7 @@
// 1. set the string to ""
// 2. use type _LCDML_TYPE_dynParam instead of _LCDML_TYPE_default
// this function type can not be used in combination with different parameters
// LCDMenuLib_add(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
// LCDMenuLib_addAdvanced(id, prev_layer, new_num, condition, lang_char_array, callback_function, parameter (0-255), menu function type )
LCDML_addAdvanced (21 , LCDML_0 , 6 , NULL, "" , mDyn_para, 0, _LCDML_TYPE_dynParam); // NULL = no menu function
// Example for conditions (for example for a screensaver)

@ -0,0 +1,646 @@
// =====================================================================
//
// CONTROL v2.2.0
//
// =====================================================================
// *********************************************************************
// Features
// - max 6 Buttons with special names (enter, quit, up, down, left, right)
// new Features on v2.2.0
// - max 64 Events, this could be a button ore something (Counter 0 - 63)
// - standard buttons and events can be used at the same time
// - Event 0 - 3 can be used with a menu callback function (when set this event, the function is called)
// - The range from 0 - 3 can be changed in LCDMenuLib2.h
// Attention!!
// - events have to be reset manual over LCDML.CE_reset(number) ore LCDML.CE_resetAll();
// - they will not be reseted from the menu library
// *********************************************************************
// content:
// (0) Control over serial interface with asdw_e_q
// (1) Control over one analog input
// (2) Control over 4 - 6 digital input pins (internal pullups enabled)
// (3) Control over encoder [third party lib] (Download: https://github.com/PaulStoffregen/Encoder)
// (4) Control with Keypad [third party lib] (Download: http://playground.arduino.cc/Main/KeypadTutorial )
// (5) Control with an IRMP remote [third party lib] (Download: https://github.com/ukw100/IRMP )
// (6) Control with a joystick
// (7) Control over I2C PCF8574
// *********************************************************************
#define _LCDML_CONTROL_cfg 0
// theory:
// "#if" is a preprocessor directive and no error, look here:
// (English) https://en.wikipedia.org/wiki/C_preprocessor
// (German) https://de.wikipedia.org/wiki/C-Pr%C3%A4prozessor
// *********************************************************************
// *************** (0) CONTROL OVER SERIAL INTERFACE *******************
// *********************************************************************
#if(_LCDML_CONTROL_cfg == 0)
// settings
# define _LCDML_CONTROL_serial_enter 'e'
# define _LCDML_CONTROL_serial_up 'w'
# define _LCDML_CONTROL_serial_down 's'
# define _LCDML_CONTROL_serial_left 'a'
# define _LCDML_CONTROL_serial_right 'd'
# define _LCDML_CONTROL_serial_quit 'q'
// example for the useage of events (not needed everywhere)
// this defines are only for examples and can be renamed
# define _LCDML_EVENT_command 'c'
# define _LCDML_EVENT_char_0 '0'
# define _LCDML_EVENT_char_1 '1'
# define _LCDML_EVENT_char_2 '2'
# define _LCDML_EVENT_char_3 '3'
# define _LCDML_EVENT_char_4 '4'
# define _LCDML_EVENT_char_5 '5'
# define _LCDML_EVENT_char_6 '6'
# define _LCDML_EVENT_char_7 '7'
# define _LCDML_EVENT_char_8 '8'
# define _LCDML_EVENT_char_9 '9'
// *********************************************************************
void lcdml_menu_control(void)
{
// If something must init, put in in the setup condition
if(LCDML.BT_setup()) {
// runs only once
}
if(LCDML.CE_setup()) {
// runs only once
}
// check if new serial input is available
if (Serial.available()) {
// read one char from input buffer
switch (Serial.read())
{
case _LCDML_CONTROL_serial_enter: LCDML.BT_enter(); break;
case _LCDML_CONTROL_serial_up: LCDML.BT_up(); break;
case _LCDML_CONTROL_serial_down: LCDML.BT_down(); break;
case _LCDML_CONTROL_serial_left: LCDML.BT_left(); break;
case _LCDML_CONTROL_serial_right: LCDML.BT_right(); break;
case _LCDML_CONTROL_serial_quit: LCDML.BT_quit(); break;
// example for event handling
// custom event handling
// is is also possible to enable more the one event on the same time
// but when more then one events with callback functions are active
// only the first callback function is called. (first = by number)
case _LCDML_EVENT_command: LCDML.CE_set(0); break;
case _LCDML_EVENT_char_0: LCDML.CE_set(1); break;
case _LCDML_EVENT_char_1: LCDML.CE_set(2); break;
case _LCDML_EVENT_char_2: LCDML.CE_set(3); break;
case _LCDML_EVENT_char_3: LCDML.CE_set(4); break;
case _LCDML_EVENT_char_4: LCDML.CE_set(5); break;
case _LCDML_EVENT_char_5: LCDML.CE_set(6); break;
case _LCDML_EVENT_char_6: LCDML.CE_set(7); break;
case _LCDML_EVENT_char_7: LCDML.CE_set(8); break;
case _LCDML_EVENT_char_8: LCDML.CE_set(9); break;
case _LCDML_EVENT_char_9: LCDML.CE_set(10); break;
default: break;
}
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
// *********************************************************************
// *************** (1) CONTROL OVER ONE ANALOG PIN *********************
// *********************************************************************
#elif(_LCDML_CONTROL_cfg == 1)
unsigned long g_LCDML_DISP_press_time = 0;
// settings
#define _LCDML_CONTROL_analog_pin 0
// when you did not use a button set the value to zero
#define _LCDML_CONTROL_analog_enter_min 850 // Button Enter
#define _LCDML_CONTROL_analog_enter_max 920
#define _LCDML_CONTROL_analog_up_min 520 // Button Up
#define _LCDML_CONTROL_analog_up_max 590
#define _LCDML_CONTROL_analog_down_min 700 // Button Down
#define _LCDML_CONTROL_analog_down_max 770
#define _LCDML_CONTROL_analog_back_min 950 // Button Back
#define _LCDML_CONTROL_analog_back_max 1020
#define _LCDML_CONTROL_analog_left_min 430 // Button Left
#define _LCDML_CONTROL_analog_left_max 500
#define _LCDML_CONTROL_analog_right_min 610 // Button Right
#define _LCDML_CONTROL_analog_right_max 680
// *********************************************************************
void lcdml_menu_control(void)
{
// If something must init, put in in the setup condition
if(LCDML.BT_setup()) {
// runs only once
}
// check debounce timer
if((millis() - g_LCDML_DISP_press_time) >= 200) {
g_LCDML_DISP_press_time = millis(); // reset debounce timer
uint16_t value = analogRead(_LCDML_CONTROL_analog_pin); // analog pin for keypad
if (value >= _LCDML_CONTROL_analog_enter_min && value <= _LCDML_CONTROL_analog_enter_max) { LCDML.BT_enter(); }
if (value >= _LCDML_CONTROL_analog_up_min && value <= _LCDML_CONTROL_analog_up_max) { LCDML.BT_up(); }
if (value >= _LCDML_CONTROL_analog_down_min && value <= _LCDML_CONTROL_analog_down_max) { LCDML.BT_down(); }
if (value >= _LCDML_CONTROL_analog_left_min && value <= _LCDML_CONTROL_analog_left_max) { LCDML.BT_left(); }
if (value >= _LCDML_CONTROL_analog_right_min && value <= _LCDML_CONTROL_analog_right_max) { LCDML.BT_right(); }
if (value >= _LCDML_CONTROL_analog_back_min && value <= _LCDML_CONTROL_analog_back_max) { LCDML.BT_quit(); }
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
// *********************************************************************
// *************** (2) CONTROL OVER DIGITAL PINS ***********************
// *********************************************************************
#elif(_LCDML_CONTROL_cfg == 2)
// settings
unsigned long g_LCDML_DISP_press_time = 0;
#define _LCDML_CONTROL_digital_low_active 0 // 0 = high active (pulldown) button, 1 = low active (pullup)
// http://playground.arduino.cc/CommonTopics/PullUpDownResistor
#define _LCDML_CONTROL_digital_enable_quit 1
#define _LCDML_CONTROL_digital_enable_lr 1
#define _LCDML_CONTROL_digital_enter 8
#define _LCDML_CONTROL_digital_up 9
#define _LCDML_CONTROL_digital_down 10
#define _LCDML_CONTROL_digital_quit 11
#define _LCDML_CONTROL_digital_left 12
#define _LCDML_CONTROL_digital_right 13
// *********************************************************************
void lcdml_menu_control(void)
{
// If something must init, put in in the setup condition
if(LCDML.BT_setup()) {
// runs only once
// init buttons
pinMode(_LCDML_CONTROL_digital_enter , INPUT_PULLUP);
pinMode(_LCDML_CONTROL_digital_up , INPUT_PULLUP);
pinMode(_LCDML_CONTROL_digital_down , INPUT_PULLUP);
# if(_LCDML_CONTROL_digital_enable_quit == 1)
pinMode(_LCDML_CONTROL_digital_quit , INPUT_PULLUP);
# endif
# if(_LCDML_CONTROL_digital_enable_lr == 1)
pinMode(_LCDML_CONTROL_digital_left , INPUT_PULLUP);
pinMode(_LCDML_CONTROL_digital_right , INPUT_PULLUP);
# endif
}
#if(_LCDML_CONTROL_digital_low_active == 1)
# define _LCDML_CONTROL_digital_a !
#else
# define _LCDML_CONTROL_digital_a
#endif
uint8_t but_stat = 0x00;
bitWrite(but_stat, 0, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_enter)));
bitWrite(but_stat, 1, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_up)));
bitWrite(but_stat, 2, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_down)));
#if(_LCDML_CONTROL_digital_enable_quit == 1)
bitWrite(but_stat, 3, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_quit)));
#endif
#if(_LCDML_CONTROL_digital_enable_lr == 1)
bitWrite(but_stat, 4, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_left)));
bitWrite(but_stat, 5, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_right)));
#endif
if (but_stat > 0) {
if((millis() - g_LCDML_DISP_press_time) >= 200) {
g_LCDML_DISP_press_time = millis(); // reset press time
if (bitRead(but_stat, 0)) { LCDML.BT_enter(); }
if (bitRead(but_stat, 1)) { LCDML.BT_up(); }
if (bitRead(but_stat, 2)) { LCDML.BT_down(); }
if (bitRead(but_stat, 3)) { LCDML.BT_quit(); }
if (bitRead(but_stat, 4)) { LCDML.BT_left(); }
if (bitRead(but_stat, 5)) { LCDML.BT_right(); }
}
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
// *********************************************************************
// *************** (3) CONTROL WITH ENCODER ****************************
// *********************************************************************
#elif(_LCDML_CONTROL_cfg == 3)
/*
* Thanks to "MuchMore" (Arduino forum) to add this encoder functionality
*
* rotate left = Up
* rotate right = Down
* push = Enter
* push long = Quit
* push + rotate left = Left
* push + rotate right = Right
*/
/* encoder connection
* button * (do not use an external resistor, the internal pullup resistor is used)
* .-------o Arduino Pin
* |
* |
* o /
* /
* /
* o
* |
* '-------o GND
*
* encoder * (do not use an external resistor, the internal pullup resistors are used)
*
* .---------------o Arduino Pin A
* | .------o Arduino Pin B
* | |
* o / o /
* / /
* / /
* o o
* | |
* '--------o----o GND (common pin)
*/
// global defines
#define encoder_A_pin 20 // physical pin has to be 2 or 3 to use interrupts (on mega e.g. 20 or 21), use internal pullups
#define encoder_B_pin 21 // physical pin has to be 2 or 3 to use interrupts (on mega e.g. 20 or 21), use internal pullups
#define encoder_button_pin 49 // physical pin , use internal pullup
#define g_LCDML_CONTROL_button_long_press 800 // ms
#define g_LCDML_CONTROL_button_short_press 120 // ms
#define ENCODER_OPTIMIZE_INTERRUPTS //Only when using pin2/3 (or 20/21 on mega)
#include <Encoder.h> //for Encoder Download: https://github.com/PaulStoffregen/Encoder
Encoder ENCODER(encoder_A_pin, encoder_B_pin);
unsigned long g_LCDML_CONTROL_button_press_time = millis();
bool g_LCDML_CONTROL_button_prev = HIGH;
// *********************************************************************
void lcdml_menu_control(void)
// *********************************************************************
{
// declare variable for this function
int32_t g_LCDML_CONTROL_Encoder_position = ENCODER.read();
bool g_LCDML_button = digitalRead(encoder_button_pin);
// If something must init, put in in the setup condition
if(LCDML.BT_setup())
{
// runs only once
// init pins, enable pullups
pinMode(encoder_A_pin , INPUT_PULLUP);
pinMode(encoder_B_pin , INPUT_PULLUP);
pinMode(encoder_button_pin , INPUT_PULLUP);
}
// check if encoder is rotated on direction A
if(g_LCDML_CONTROL_Encoder_position <= -3)
{
// check if the button is pressed and the encoder is rotated
// the button is low active
if(g_LCDML_button == LOW)
{
// button is pressed
LCDML.BT_left();
// reset button press time for next detection
g_LCDML_CONTROL_button_prev = HIGH;
}
else
{
LCDML.BT_down();
}
// init encoder for the next step
ENCODER.write(g_LCDML_CONTROL_Encoder_position+4);
}
// check if encoder is rotated on direction B
else if(g_LCDML_CONTROL_Encoder_position >= 3)
{
// check if the button is pressed and the encoder is rotated
// the button is low active
if(g_LCDML_button == LOW)
{
// button is pressed
LCDML.BT_right();
// reset button press time for next detection
g_LCDML_CONTROL_button_prev = HIGH;
}
else
{
LCDML.BT_up();
}
// init encoder for the next step
ENCODER.write(g_LCDML_CONTROL_Encoder_position-4);
}
else
{
// check if the button was pressed for a shortly time or a long time
//falling edge, button pressed, no action
if(g_LCDML_button == LOW && g_LCDML_CONTROL_button_prev == HIGH)
{
g_LCDML_CONTROL_button_prev = LOW;
g_LCDML_CONTROL_button_press_time = millis();
}
// rising edge, button not pressed, check how long was it pressed
else if(g_LCDML_button == HIGH && g_LCDML_CONTROL_button_prev == LOW)
{
g_LCDML_CONTROL_button_prev = HIGH;
// check how long was the button pressed and detect a long press or a short press
// check long press situation
if((millis() - g_LCDML_CONTROL_button_press_time) >= g_LCDML_CONTROL_button_long_press)
{
// long press detected
LCDML.BT_quit();
}
// check short press situation
else if((millis() - g_LCDML_CONTROL_button_press_time) >= g_LCDML_CONTROL_button_short_press)
{
// short press detected
LCDML.BT_enter();
}
}
// do nothing
else
{
// do nothing
}
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
// *********************************************************************
// *************** (4) CONTROL WITH A KEYPAD ***************************
// *********************************************************************
#elif(_LCDML_CONTROL_cfg == 4)
// include
// more information under http://playground.arduino.cc/Main/KeypadTutorial
#include <Keypad.h>
// settings
#define _LCDML_CONTROL_keypad_rows 4 // Four rows
#define _LCDML_CONTROL_keypad_cols 3 // Three columns
// global vars
char keys[_LCDML_CONTROL_keypad_rows][_LCDML_CONTROL_keypad_cols] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'#','0','*'}
};
byte rowPins[_LCDML_CONTROL_keypad_rows] = { 9, 8, 7, 6 }; // Connect keypad COL0, COL1 and COL2 to these Arduino pins.
byte colPins[_LCDML_CONTROL_keypad_cols] = { 12, 11, 10 }; // Create the Keypad
// objects
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, _LCDML_CONTROL_keypad_rows, _LCDML_CONTROL_keypad_cols );
// *********************************************************************
void lcdml_menu_control(void)
{
// If something must init, put in in the setup condition
if(LCDML.BT_setup()) {
// runs only once
}
char key = kpd.getKey();
if(key) // Check for a valid key.
{
switch (key)
{
// this is the default configuration
case '#': LCDML.BT_enter(); break;
case '2': LCDML.BT_up(); break;
case '8': LCDML.BT_down(); break;
case '4': LCDML.BT_left(); break;
case '6': LCDML.BT_right(); break;
case '*': LCDML.BT_quit(); break;
// when you want to use all characters you have to use the CE_ functionality
// CE stands for "custom event" and you can define 64 evetns
// the following code is only an example
/*
case '1': LCDML.CE_set(2); break;
case '2': LCDML.CE_set(3); LCDML.BT_up(); break;
case '3': LCDML.CE_set(4); break;
case '4': LCDML.CE_set(5); LCDML.BT_left(); break;
case '5': LCDML.CE_set(6); break;
case '6': LCDML.CE_set(7); LCDML.BT_right(); break;
case '7': LCDML.CE_set(8); break;
case '8': LCDML.CE_set(9); LCDML.BT_down(); break;
case '9': LCDML.CE_set(10); break;
case '0': LCDML.CE_set(1); break;
case '#': LCDML.CE_set(12); LCDML.BT_enter(); break;
case '*': LCDML.CE_set(11); LCDML.BT_quit(); break;
*/
default: break;
}
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
// *********************************************************************
// *************** (5) CONTROL WITH IR REMOTE ***************************
// *********************************************************************
#elif(_LCDML_CONTROL_cfg == 5)
// IR include (this lib have to be installed)
// Download path: https://github.com/ukw100/IRMP
#define IRMP_INPUT_PIN PA0
#define IRMP_PROTOCOL_NAMES 1 // Enable protocol number mapping to protocol strings - needs some FLASH. Must before #include <irmp*>
#include <irmpSelectMain15Protocols.h> // This enables 15 main protocols
#include <irmp.c.h>
IRMP_DATA irmp_data[1];
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
void handleReceivedIRData();
// *********************************************************************
// change in this function the IR values to your values
void lcdml_menu_control(void)
{
// If something must init, put in in the setup condition
if(LCDML.BT_setup()) {
// runs only once
irmp_init();
}
if (irmp_get_data(&irmp_data[0]))
{
// comment this line out, to check the correct code
//Serial.println(results.value, HEX);
// in this switch case you have to change the value 0x...1 to the correct IR code
switch (irmp_data[0].command)
{
case 0x52: LCDML.BT_enter(); break;
case 0x50: LCDML.BT_up(); break;
case 0x51: LCDML.BT_down(); break;
case 0x55: LCDML.BT_left(); break;
case 0x56: LCDML.BT_right(); break;
case 0x23: LCDML.BT_quit(); break;
default: break;
}
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
// *********************************************************************
// *************** (6) CONTROL OVER JOYSTICK ***************************
// *********************************************************************
#elif(_LCDML_CONTROL_cfg == 6)
unsigned long g_LCDML_DISP_press_time = 0;
// settings
#define _LCDML_CONTROL_analog_pinx A0
#define _LCDML_CONTROL_analog_piny A1
#define _LCDML_CONTROL_digitalread 33 //don't work with u8glib
// when you did not use a button set the value to zero
#define _LCDML_CONTROL_analog_up_min 612 // Button Up
#define _LCDML_CONTROL_analog_up_max 1023
#define _LCDML_CONTROL_analog_down_min 0 // Button Down
#define _LCDML_CONTROL_analog_down_max 412
#define _LCDML_CONTROL_analog_left_min 612 // Button Left
#define _LCDML_CONTROL_analog_left_max 1023
#define _LCDML_CONTROL_analog_right_min 0 // Button Right
#define _LCDML_CONTROL_analog_right_max 412
// *********************************************************************
void lcdml_menu_control(void)
{
// If something must init, put in in the setup condition
if(LCDML.BT_setup()) {
// runs only once
pinMode (_LCDML_CONTROL_digitalread, INPUT);
}
// check debounce timer
if((millis() - g_LCDML_DISP_press_time) >= 200) {
g_LCDML_DISP_press_time = millis(); // reset debounce timer
uint16_t valuex = analogRead(_LCDML_CONTROL_analog_pinx); // analogpinx
uint16_t valuey = analogRead(_LCDML_CONTROL_analog_piny); // analogpinx
uint16_t valuee = digitalRead(_LCDML_CONTROL_digitalread); //digitalpinenter
if (valuey >= _LCDML_CONTROL_analog_up_min && valuey <= _LCDML_CONTROL_analog_up_max) { LCDML.BT_up(); } // up
if (valuey >= _LCDML_CONTROL_analog_down_min && valuey <= _LCDML_CONTROL_analog_down_max) { LCDML.BT_down(); } // down
if (valuex >= _LCDML_CONTROL_analog_left_min && valuex <= _LCDML_CONTROL_analog_left_max) { LCDML.BT_left(); } // left
if (valuex >= _LCDML_CONTROL_analog_right_min && valuex <= _LCDML_CONTROL_analog_right_max) { LCDML.BT_right(); } // right
if(valuee == true) {LCDML.BT_enter();} // enter
// back buttons have to be included as menu item
// lock at the example LCDML_back_button
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
// *********************************************************************
// *************** (7) CONTROL OVER PCF8574 ****************************
// *********************************************************************
#elif(_LCDML_CONTROL_cfg == 7)
unsigned long g_LCDML_DISP_press_time = 0;
#define PCF8574_1 0x26 // I2C address for the buttons
#define PCF8574_Pin0 254
#define PCF8574_Pin1 253
#define PCF8574_Pin2 251
#define PCF8574_Pin3 247
#define PCF8574_Pin4 239
#define PCF8574_Pin5 223
#define PCF8574_Pin6 191
#define PCF8574_Pin7 127
// Specify the PCF8574 pins here
#define _LCDML_CONTROL_PCF8574_enable_quit 0
#define _LCDML_CONTROL_PCF8574_enable_lr 0
#define _LCDML_CONTROL_PCF8574_enter PCF8574_Pin0
#define _LCDML_CONTROL_PCF8574_up PCF8574_Pin1
#define _LCDML_CONTROL_PCF8574_down PCF8574_Pin2
#define _LCDML_CONTROL_PCF8574_left PCF8574_Pin3
#define _LCDML_CONTROL_PCF8574_right PCF8574_Pin4
#define _LCDML_CONTROL_PCF8574_quit PCF8574_Pin5
// **********************************************************
void lcdml_menu_control(void)
{
// If something must init, put in in the setup condition
if(LCDML.BT_setup()) {
// runs only once
}
if((millis() - g_LCDML_DISP_press_time) >= 200) {
g_LCDML_DISP_press_time = millis(); // reset press time
Wire.write(0xff); // All pins as input?
Wire.requestFrom(PCF8574_1, 1);
if (Wire.available()) {
switch (Wire.read())
{
case _LCDML_CONTROL_PCF8574_enter: LCDML.BT_enter(); break;
case _LCDML_CONTROL_PCF8574_up: LCDML.BT_up(); break;
case _LCDML_CONTROL_PCF8574_down: LCDML.BT_down(); break;
#if(_LCDML_CONTROL_PCF8574_enable_quit == 1)
case _LCDML_CONTROL_PCF8574_quit: LCDML.BT_quit(); break;
#endif
#if(_LCDML_CONTROL_PCF8574_enable_lr == 1)
case _LCDML_CONTROL_PCF8574_left: LCDML.BT_left(); break;
case _LCDML_CONTROL_PCF8574_right: LCDML.BT_right(); break;
#endif
default: break;
}
}
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
#else
#error _LCDML_CONTROL_cfg is not defined or not in range
#endif

@ -1,647 +0,0 @@
// =====================================================================
//
// CONTROL v2.2.0
//
// =====================================================================
// *********************************************************************
// Features
// - max 6 Buttons with special names (enter, quit, up, down, left, right)
// new Features on v2.2.0
// - max 64 Events, this could be a button ore something (Counter 0 - 63)
// - standard buttons and events can be used at the same time
// - Event 0 - 3 can be used with a menu callback function (when set this event, the function is called)
// - The range from 0 - 3 can be changed in LCDMenuLib2.h
// Attention!!
// - events have to be reset manual over LCDML.CE_reset(number) ore LCDML.CE_resetAll();
// - they will not be reseted from the menu library
// *********************************************************************
// content:
// (0) Control over serial interface with asdw_e_q
// (1) Control over one analog input
// (2) Control over 4 - 6 digital input pins (internal pullups enabled)
// (3) Control over encoder [third party lib] (Download: https://github.com/PaulStoffregen/Encoder)
// (4) Control with Keypad [third party lib] (Download: http://playground.arduino.cc/Main/KeypadTutorial )
// (5) Control with an IRMP remote [third party lib] (Download: https://github.com/ukw100/IRMP )
// (6) Control with a joystick
// (7) Control over I2C PCF8574
// *********************************************************************
#define _LCDML_CONTROL_cfg 0
// theory:
// "#if" is a preprocessor directive and no error, look here:
// (English) https://en.wikipedia.org/wiki/C_preprocessor
// (German) https://de.wikipedia.org/wiki/C-Pr%C3%A4prozessor
// *********************************************************************
// *************** (0) CONTROL OVER SERIAL INTERFACE *******************
// *********************************************************************
#if(_LCDML_CONTROL_cfg == 0)
// settings
# define _LCDML_CONTROL_serial_enter 'e'
# define _LCDML_CONTROL_serial_up 'w'
# define _LCDML_CONTROL_serial_down 's'
# define _LCDML_CONTROL_serial_left 'a'
# define _LCDML_CONTROL_serial_right 'd'
# define _LCDML_CONTROL_serial_quit 'q'
// example for the useage of events (not needed everywhere)
// this defines are only for examples and can be renamed
# define _LCDML_EVENT_command 'c'
# define _LCDML_EVENT_char_0 '0'
# define _LCDML_EVENT_char_1 '1'
# define _LCDML_EVENT_char_2 '2'
# define _LCDML_EVENT_char_3 '3'
# define _LCDML_EVENT_char_4 '4'
# define _LCDML_EVENT_char_5 '5'
# define _LCDML_EVENT_char_6 '6'
# define _LCDML_EVENT_char_7 '7'
# define _LCDML_EVENT_char_8 '8'
# define _LCDML_EVENT_char_9 '9'
// *********************************************************************
void lcdml_menu_control(void)
{
// If something must init, put in in the setup condition
if(LCDML.BT_setup()) {
// runs only once
}
if(LCDML.CE_setup()) {
// runs only once
Serial.println("CE_setup()");
}
// check if new serial input is available
if (Serial.available()) {
// read one char from input buffer
switch (Serial.read())
{
case _LCDML_CONTROL_serial_enter: LCDML.BT_enter(); break;
case _LCDML_CONTROL_serial_up: LCDML.BT_up(); break;
case _LCDML_CONTROL_serial_down: LCDML.BT_down(); break;
case _LCDML_CONTROL_serial_left: LCDML.BT_left(); break;
case _LCDML_CONTROL_serial_right: LCDML.BT_right(); break;
case _LCDML_CONTROL_serial_quit: LCDML.BT_quit(); break;
// example for event handling
// custom event handling
// is is also possible to enable more the one event on the same time
// but when more then one events with callback functions are active
// only the first callback function is called. (first = by number)
case _LCDML_EVENT_command: LCDML.CE_set(0); break;
case _LCDML_EVENT_char_0: LCDML.CE_set(1); break;
case _LCDML_EVENT_char_1: LCDML.CE_set(2); break;
case _LCDML_EVENT_char_2: LCDML.CE_set(3); break;
case _LCDML_EVENT_char_3: LCDML.CE_set(4); break;
case _LCDML_EVENT_char_4: LCDML.CE_set(5); break;
case _LCDML_EVENT_char_5: LCDML.CE_set(6); break;
case _LCDML_EVENT_char_6: LCDML.CE_set(7); break;
case _LCDML_EVENT_char_7: LCDML.CE_set(8); break;
case _LCDML_EVENT_char_8: LCDML.CE_set(9); break;
case _LCDML_EVENT_char_9: LCDML.CE_set(10); break;
default: break;
}
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
// *********************************************************************
// *************** (1) CONTROL OVER ONE ANALOG PIN *********************
// *********************************************************************
#elif(_LCDML_CONTROL_cfg == 1)
unsigned long g_LCDML_DISP_press_time = 0;
// settings
#define _LCDML_CONTROL_analog_pin 0
// when you did not use a button set the value to zero
#define _LCDML_CONTROL_analog_enter_min 850 // Button Enter
#define _LCDML_CONTROL_analog_enter_max 920
#define _LCDML_CONTROL_analog_up_min 520 // Button Up
#define _LCDML_CONTROL_analog_up_max 590
#define _LCDML_CONTROL_analog_down_min 700 // Button Down
#define _LCDML_CONTROL_analog_down_max 770
#define _LCDML_CONTROL_analog_back_min 950 // Button Back
#define _LCDML_CONTROL_analog_back_max 1020
#define _LCDML_CONTROL_analog_left_min 430 // Button Left
#define _LCDML_CONTROL_analog_left_max 500
#define _LCDML_CONTROL_analog_right_min 610 // Button Right
#define _LCDML_CONTROL_analog_right_max 680
// *********************************************************************
void lcdml_menu_control(void)
{
// If something must init, put in in the setup condition
if(LCDML.BT_setup()) {
// runs only once
}
// check debounce timer
if((millis() - g_LCDML_DISP_press_time) >= 200) {
g_LCDML_DISP_press_time = millis(); // reset debounce timer
uint16_t value = analogRead(_LCDML_CONTROL_analog_pin); // analog pin for keypad
if (value >= _LCDML_CONTROL_analog_enter_min && value <= _LCDML_CONTROL_analog_enter_max) { LCDML.BT_enter(); }
if (value >= _LCDML_CONTROL_analog_up_min && value <= _LCDML_CONTROL_analog_up_max) { LCDML.BT_up(); }
if (value >= _LCDML_CONTROL_analog_down_min && value <= _LCDML_CONTROL_analog_down_max) { LCDML.BT_down(); }
if (value >= _LCDML_CONTROL_analog_left_min && value <= _LCDML_CONTROL_analog_left_max) { LCDML.BT_left(); }
if (value >= _LCDML_CONTROL_analog_right_min && value <= _LCDML_CONTROL_analog_right_max) { LCDML.BT_right(); }
if (value >= _LCDML_CONTROL_analog_back_min && value <= _LCDML_CONTROL_analog_back_max) { LCDML.BT_quit(); }
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
// *********************************************************************
// *************** (2) CONTROL OVER DIGITAL PINS ***********************
// *********************************************************************
#elif(_LCDML_CONTROL_cfg == 2)
// settings
unsigned long g_LCDML_DISP_press_time = 0;
#define _LCDML_CONTROL_digital_low_active 0 // 0 = high active (pulldown) button, 1 = low active (pullup)
// http://playground.arduino.cc/CommonTopics/PullUpDownResistor
#define _LCDML_CONTROL_digital_enable_quit 1
#define _LCDML_CONTROL_digital_enable_lr 1
#define _LCDML_CONTROL_digital_enter 8
#define _LCDML_CONTROL_digital_up 9
#define _LCDML_CONTROL_digital_down 10
#define _LCDML_CONTROL_digital_quit 11
#define _LCDML_CONTROL_digital_left 12
#define _LCDML_CONTROL_digital_right 13
// *********************************************************************
void lcdml_menu_control(void)
{
// If something must init, put in in the setup condition
if(LCDML.BT_setup()) {
// runs only once
// init buttons
pinMode(_LCDML_CONTROL_digital_enter , INPUT_PULLUP);
pinMode(_LCDML_CONTROL_digital_up , INPUT_PULLUP);
pinMode(_LCDML_CONTROL_digital_down , INPUT_PULLUP);
# if(_LCDML_CONTROL_digital_enable_quit == 1)
pinMode(_LCDML_CONTROL_digital_quit , INPUT_PULLUP);
# endif
# if(_LCDML_CONTROL_digital_enable_lr == 1)
pinMode(_LCDML_CONTROL_digital_left , INPUT_PULLUP);
pinMode(_LCDML_CONTROL_digital_right , INPUT_PULLUP);
# endif
}
#if(_LCDML_CONTROL_digital_low_active == 1)
# define _LCDML_CONTROL_digital_a !
#else
# define _LCDML_CONTROL_digital_a
#endif
uint8_t but_stat = 0x00;
bitWrite(but_stat, 0, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_enter)));
bitWrite(but_stat, 1, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_up)));
bitWrite(but_stat, 2, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_down)));
#if(_LCDML_CONTROL_digital_enable_quit == 1)
bitWrite(but_stat, 3, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_quit)));
#endif
#if(_LCDML_CONTROL_digital_enable_lr == 1)
bitWrite(but_stat, 4, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_left)));
bitWrite(but_stat, 5, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_right)));
#endif
if (but_stat > 0) {
if((millis() - g_LCDML_DISP_press_time) >= 200) {
g_LCDML_DISP_press_time = millis(); // reset press time
if (bitRead(but_stat, 0)) { LCDML.BT_enter(); }
if (bitRead(but_stat, 1)) { LCDML.BT_up(); }
if (bitRead(but_stat, 2)) { LCDML.BT_down(); }
if (bitRead(but_stat, 3)) { LCDML.BT_quit(); }
if (bitRead(but_stat, 4)) { LCDML.BT_left(); }
if (bitRead(but_stat, 5)) { LCDML.BT_right(); }
}
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
// *********************************************************************
// *************** (3) CONTROL WITH ENCODER ****************************
// *********************************************************************
#elif(_LCDML_CONTROL_cfg == 3)
/*
* Thanks to "MuchMore" (Arduino forum) to add this encoder functionality
*
* rotate left = Up
* rotate right = Down
* push = Enter
* push long = Quit
* push + rotate left = Left
* push + rotate right = Right
*/
/* encoder connection
* button * (do not use an external resistor, the internal pullup resistor is used)
* .-------o Arduino Pin
* |
* |
* o /
* /
* /
* o
* |
* '-------o GND
*
* encoder * (do not use an external resistor, the internal pullup resistors are used)
*
* .---------------o Arduino Pin A
* | .------o Arduino Pin B
* | |
* o / o /
* / /
* / /
* o o
* | |
* '--------o----o GND (common pin)
*/
// global defines
#define encoder_A_pin 20 // physical pin has to be 2 or 3 to use interrupts (on mega e.g. 20 or 21), use internal pullups
#define encoder_B_pin 21 // physical pin has to be 2 or 3 to use interrupts (on mega e.g. 20 or 21), use internal pullups
#define encoder_button_pin 49 // physical pin , use internal pullup
#define g_LCDML_CONTROL_button_long_press 800 // ms
#define g_LCDML_CONTROL_button_short_press 120 // ms
#define ENCODER_OPTIMIZE_INTERRUPTS //Only when using pin2/3 (or 20/21 on mega)
#include <Encoder.h> //for Encoder Download: https://github.com/PaulStoffregen/Encoder
Encoder ENCODER(encoder_A_pin, encoder_B_pin);
unsigned long g_LCDML_CONTROL_button_press_time = millis();
bool g_LCDML_CONTROL_button_prev = HIGH;
// *********************************************************************
void lcdml_menu_control(void)
// *********************************************************************
{
// declare variable for this function
int32_t g_LCDML_CONTROL_Encoder_position = ENCODER.read();
bool g_LCDML_button = digitalRead(encoder_button_pin);
// If something must init, put in in the setup condition
if(LCDML.BT_setup())
{
// runs only once
// init pins, enable pullups
pinMode(encoder_A_pin , INPUT_PULLUP);
pinMode(encoder_B_pin , INPUT_PULLUP);
pinMode(encoder_button_pin , INPUT_PULLUP);
}
// check if encoder is rotated on direction A
if(g_LCDML_CONTROL_Encoder_position <= -3)
{
// check if the button is pressed and the encoder is rotated
// the button is low active
if(g_LCDML_button == LOW)
{
// button is pressed
LCDML.BT_left();
// reset button press time for next detection
g_LCDML_CONTROL_button_prev = HIGH;
}
else
{
LCDML.BT_down();
}
// init encoder for the next step
ENCODER.write(g_LCDML_CONTROL_Encoder_position+4);
}
// check if encoder is rotated on direction B
else if(g_LCDML_CONTROL_Encoder_position >= 3)
{
// check if the button is pressed and the encoder is rotated
// the button is low active
if(g_LCDML_button == LOW)
{
// button is pressed
LCDML.BT_right();
// reset button press time for next detection
g_LCDML_CONTROL_button_prev = HIGH;
}
else
{
LCDML.BT_up();
}
// init encoder for the next step
ENCODER.write(g_LCDML_CONTROL_Encoder_position-4);
}
else
{
// check if the button was pressed for a shortly time or a long time
//falling edge, button pressed, no action
if(g_LCDML_button == LOW && g_LCDML_CONTROL_button_prev == HIGH)
{
g_LCDML_CONTROL_button_prev = LOW;
g_LCDML_CONTROL_button_press_time = millis();
}
// rising edge, button not pressed, check how long was it pressed
else if(g_LCDML_button == HIGH && g_LCDML_CONTROL_button_prev == LOW)
{
g_LCDML_CONTROL_button_prev = HIGH;
// check how long was the button pressed and detect a long press or a short press
// check long press situation
if((millis() - g_LCDML_CONTROL_button_press_time) >= g_LCDML_CONTROL_button_long_press)
{
// long press detected
LCDML.BT_quit();
}
// check short press situation
else if((millis() - g_LCDML_CONTROL_button_press_time) >= g_LCDML_CONTROL_button_short_press)
{
// short press detected
LCDML.BT_enter();
}
}
// do nothing
else
{
// do nothing
}
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
// *********************************************************************
// *************** (4) CONTROL WITH A KEYPAD ***************************
// *********************************************************************
#elif(_LCDML_CONTROL_cfg == 4)
// include
// more information under http://playground.arduino.cc/Main/KeypadTutorial
#include <Keypad.h>
// settings
#define _LCDML_CONTROL_keypad_rows 4 // Four rows
#define _LCDML_CONTROL_keypad_cols 3 // Three columns
// global vars
char keys[_LCDML_CONTROL_keypad_rows][_LCDML_CONTROL_keypad_cols] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'#','0','*'}
};
byte rowPins[_LCDML_CONTROL_keypad_rows] = { 9, 8, 7, 6 }; // Connect keypad COL0, COL1 and COL2 to these Arduino pins.
byte colPins[_LCDML_CONTROL_keypad_cols] = { 12, 11, 10 }; // Create the Keypad
// objects
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, _LCDML_CONTROL_keypad_rows, _LCDML_CONTROL_keypad_cols );
// *********************************************************************
void lcdml_menu_control(void)
{
// If something must init, put in in the setup condition
if(LCDML.BT_setup()) {
// runs only once
}
char key = kpd.getKey();
if(key) // Check for a valid key.
{
switch (key)
{
// this is the default configuration
case '#': LCDML.BT_enter(); break;
case '2': LCDML.BT_up(); break;
case '8': LCDML.BT_down(); break;
case '4': LCDML.BT_left(); break;
case '6': LCDML.BT_right(); break;
case '*': LCDML.BT_quit(); break;
// when you want to use all characters you have to use the CE_ functionality
// CE stands for "custom event" and you can define 64 evetns
// the following code is only an example
/*
case '1': LCDML.CE_set(2); break;
case '2': LCDML.CE_set(3); LCDML.BT_up(); break;
case '3': LCDML.CE_set(4); break;
case '4': LCDML.CE_set(5); LCDML.BT_left(); break;
case '5': LCDML.CE_set(6); break;
case '6': LCDML.CE_set(7); LCDML.BT_right(); break;
case '7': LCDML.CE_set(8); break;
case '8': LCDML.CE_set(9); LCDML.BT_down(); break;
case '9': LCDML.CE_set(10); break;
case '0': LCDML.CE_set(1); break;
case '#': LCDML.CE_set(12); LCDML.BT_enter(); break;
case '*': LCDML.CE_set(11); LCDML.BT_quit(); break;
*/
default: break;
}
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
// *********************************************************************
// *************** (5) CONTROL WITH IR REMOTE ***************************
// *********************************************************************
#elif(_LCDML_CONTROL_cfg == 5)
// IR include (this lib have to be installed)
// Download path: https://github.com/ukw100/IRMP
#define IRMP_INPUT_PIN PA0
#define IRMP_PROTOCOL_NAMES 1 // Enable protocol number mapping to protocol strings - needs some FLASH. Must before #include <irmp*>
#include <irmpSelectMain15Protocols.h> // This enables 15 main protocols
#include <irmp.c.h>
IRMP_DATA irmp_data[1];
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
void handleReceivedIRData();
// *********************************************************************
// change in this function the IR values to your values
void lcdml_menu_control(void)
{
// If something must init, put in in the setup condition
if(LCDML.BT_setup()) {
// runs only once
irmp_init();
}
if (irmp_get_data(&irmp_data[0]))
{
// comment this line out, to check the correct code
//Serial.println(results.value, HEX);
// in this switch case you have to change the value 0x...1 to the correct IR code
switch (irmp_data[0].command)
{
case 0x52: LCDML.BT_enter(); break;
case 0x50: LCDML.BT_up(); break;
case 0x51: LCDML.BT_down(); break;
case 0x55: LCDML.BT_left(); break;
case 0x56: LCDML.BT_right(); break;
case 0x23: LCDML.BT_quit(); break;
default: break;
}
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
// *********************************************************************
// *************** (6) CONTROL OVER JOYSTICK ***************************
// *********************************************************************
#elif(_LCDML_CONTROL_cfg == 6)
unsigned long g_LCDML_DISP_press_time = 0;
// settings
#define _LCDML_CONTROL_analog_pinx A0
#define _LCDML_CONTROL_analog_piny A1
#define _LCDML_CONTROL_digitalread 33 //don't work with u8glib
// when you did not use a button set the value to zero
#define _LCDML_CONTROL_analog_up_min 612 // Button Up
#define _LCDML_CONTROL_analog_up_max 1023
#define _LCDML_CONTROL_analog_down_min 0 // Button Down
#define _LCDML_CONTROL_analog_down_max 412
#define _LCDML_CONTROL_analog_left_min 612 // Button Left
#define _LCDML_CONTROL_analog_left_max 1023
#define _LCDML_CONTROL_analog_right_min 0 // Button Right
#define _LCDML_CONTROL_analog_right_max 412
// *********************************************************************
void lcdml_menu_control(void)
{
// If something must init, put in in the setup condition
if(LCDML.BT_setup()) {
// runs only once
pinMode (_LCDML_CONTROL_digitalread, INPUT);
}
// check debounce timer
if((millis() - g_LCDML_DISP_press_time) >= 200) {
g_LCDML_DISP_press_time = millis(); // reset debounce timer
uint16_t valuex = analogRead(_LCDML_CONTROL_analog_pinx); // analogpinx
uint16_t valuey = analogRead(_LCDML_CONTROL_analog_piny); // analogpinx
uint16_t valuee = digitalRead(_LCDML_CONTROL_digitalread); //digitalpinenter
if (valuey >= _LCDML_CONTROL_analog_up_min && valuey <= _LCDML_CONTROL_analog_up_max) { LCDML.BT_up(); } // up
if (valuey >= _LCDML_CONTROL_analog_down_min && valuey <= _LCDML_CONTROL_analog_down_max) { LCDML.BT_down(); } // down
if (valuex >= _LCDML_CONTROL_analog_left_min && valuex <= _LCDML_CONTROL_analog_left_max) { LCDML.BT_left(); } // left
if (valuex >= _LCDML_CONTROL_analog_right_min && valuex <= _LCDML_CONTROL_analog_right_max) { LCDML.BT_right(); } // right
if(valuee == true) {LCDML.BT_enter();} // enter
// back buttons have to be included as menu item
// lock at the example LCDML_back_button
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
// *********************************************************************
// *************** (7) CONTROL OVER PCF8574 ****************************
// *********************************************************************
#elif(_LCDML_CONTROL_cfg == 7)
unsigned long g_LCDML_DISP_press_time = 0;
#define PCF8574_1 0x26 // I2C address for the buttons
#define PCF8574_Pin0 254
#define PCF8574_Pin1 253
#define PCF8574_Pin2 251
#define PCF8574_Pin3 247
#define PCF8574_Pin4 239
#define PCF8574_Pin5 223
#define PCF8574_Pin6 191
#define PCF8574_Pin7 127
// Specify the PCF8574 pins here
#define _LCDML_CONTROL_PCF8574_enable_quit 0
#define _LCDML_CONTROL_PCF8574_enable_lr 0
#define _LCDML_CONTROL_PCF8574_enter PCF8574_Pin0
#define _LCDML_CONTROL_PCF8574_up PCF8574_Pin1
#define _LCDML_CONTROL_PCF8574_down PCF8574_Pin2
#define _LCDML_CONTROL_PCF8574_left PCF8574_Pin3
#define _LCDML_CONTROL_PCF8574_right PCF8574_Pin4
#define _LCDML_CONTROL_PCF8574_quit PCF8574_Pin5
// **********************************************************
void lcdml_menu_control(void)
{
// If something must init, put in in the setup condition
if(LCDML.BT_setup()) {
// runs only once
}
if((millis() - g_LCDML_DISP_press_time) >= 200) {
g_LCDML_DISP_press_time = millis(); // reset press time
Wire.write(0xff); // All pins as input?
Wire.requestFrom(PCF8574_1, 1);
if (Wire.available()) {
switch (Wire.read())
{
case _LCDML_CONTROL_PCF8574_enter: LCDML.BT_enter(); break;
case _LCDML_CONTROL_PCF8574_up: LCDML.BT_up(); break;
case _LCDML_CONTROL_PCF8574_down: LCDML.BT_down(); break;
#if(_LCDML_CONTROL_PCF8574_enable_quit == 1)
case _LCDML_CONTROL_PCF8574_quit: LCDML.BT_quit(); break;
#endif
#if(_LCDML_CONTROL_PCF8574_enable_lr == 1)
case _LCDML_CONTROL_PCF8574_left: LCDML.BT_left(); break;
case _LCDML_CONTROL_PCF8574_right: LCDML.BT_right(); break;
#endif
default: break;
}
}
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
#else
#error _LCDML_CONTROL_cfg is not defined or not in range
#endif

@ -1,647 +0,0 @@
// =====================================================================
//
// CONTROL v2.2.0
//
// =====================================================================
// *********************************************************************
// Features
// - max 6 Buttons with special names (enter, quit, up, down, left, right)
// new Features on v2.2.0
// - max 64 Events, this could be a button ore something (Counter 0 - 63)
// - standard buttons and events can be used at the same time
// - Event 0 - 3 can be used with a menu callback function (when set this event, the function is called)
// - The range from 0 - 3 can be changed in LCDMenuLib2.h
// Attention!!
// - events have to be reset manual over LCDML.CE_reset(number) ore LCDML.CE_resetAll();
// - they will not be reseted from the menu library
// *********************************************************************
// content:
// (0) Control over serial interface with asdw_e_q
// (1) Control over one analog input
// (2) Control over 4 - 6 digital input pins (internal pullups enabled)
// (3) Control over encoder [third party lib] (Download: https://github.com/PaulStoffregen/Encoder)
// (4) Control with Keypad [third party lib] (Download: http://playground.arduino.cc/Main/KeypadTutorial )
// (5) Control with an IRMP remote [third party lib] (Download: https://github.com/ukw100/IRMP )
// (6) Control with a joystick
// (7) Control over I2C PCF8574
// *********************************************************************
#define _LCDML_CONTROL_cfg 0
// theory:
// "#if" is a preprocessor directive and no error, look here:
// (English) https://en.wikipedia.org/wiki/C_preprocessor
// (German) https://de.wikipedia.org/wiki/C-Pr%C3%A4prozessor
// *********************************************************************
// *************** (0) CONTROL OVER SERIAL INTERFACE *******************
// *********************************************************************
#if(_LCDML_CONTROL_cfg == 0)
// settings
# define _LCDML_CONTROL_serial_enter 'e'
# define _LCDML_CONTROL_serial_up 'w'
# define _LCDML_CONTROL_serial_down 's'
# define _LCDML_CONTROL_serial_left 'a'
# define _LCDML_CONTROL_serial_right 'd'
# define _LCDML_CONTROL_serial_quit 'q'
// example for the useage of events (not needed everywhere)
// this defines are only for examples and can be renamed
# define _LCDML_EVENT_command 'c'
# define _LCDML_EVENT_char_0 '0'
# define _LCDML_EVENT_char_1 '1'
# define _LCDML_EVENT_char_2 '2'
# define _LCDML_EVENT_char_3 '3'
# define _LCDML_EVENT_char_4 '4'
# define _LCDML_EVENT_char_5 '5'
# define _LCDML_EVENT_char_6 '6'
# define _LCDML_EVENT_char_7 '7'
# define _LCDML_EVENT_char_8 '8'
# define _LCDML_EVENT_char_9 '9'
// *********************************************************************
void lcdml_menu_control(void)
{
// If something must init, put in in the setup condition
if(LCDML.BT_setup()) {
// runs only once
}
if(LCDML.CE_setup()) {
// runs only once
Serial.println("CE_setup()");
}
// check if new serial input is available
if (Serial.available()) {
// read one char from input buffer
switch (Serial.read())
{
case _LCDML_CONTROL_serial_enter: LCDML.BT_enter(); break;
case _LCDML_CONTROL_serial_up: LCDML.BT_up(); break;
case _LCDML_CONTROL_serial_down: LCDML.BT_down(); break;
case _LCDML_CONTROL_serial_left: LCDML.BT_left(); break;
case _LCDML_CONTROL_serial_right: LCDML.BT_right(); break;
case _LCDML_CONTROL_serial_quit: LCDML.BT_quit(); break;
// example for event handling
// custom event handling
// is is also possible to enable more the one event on the same time
// but when more then one events with callback functions are active
// only the first callback function is called. (first = by number)
case _LCDML_EVENT_command: LCDML.CE_set(0); break;
case _LCDML_EVENT_char_0: LCDML.CE_set(1); break;
case _LCDML_EVENT_char_1: LCDML.CE_set(2); break;
case _LCDML_EVENT_char_2: LCDML.CE_set(3); break;
case _LCDML_EVENT_char_3: LCDML.CE_set(4); break;
case _LCDML_EVENT_char_4: LCDML.CE_set(5); break;
case _LCDML_EVENT_char_5: LCDML.CE_set(6); break;
case _LCDML_EVENT_char_6: LCDML.CE_set(7); break;
case _LCDML_EVENT_char_7: LCDML.CE_set(8); break;
case _LCDML_EVENT_char_8: LCDML.CE_set(9); break;
case _LCDML_EVENT_char_9: LCDML.CE_set(10); break;
default: break;
}
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
// *********************************************************************
// *************** (1) CONTROL OVER ONE ANALOG PIN *********************
// *********************************************************************
#elif(_LCDML_CONTROL_cfg == 1)
unsigned long g_LCDML_DISP_press_time = 0;
// settings
#define _LCDML_CONTROL_analog_pin 0
// when you did not use a button set the value to zero
#define _LCDML_CONTROL_analog_enter_min 850 // Button Enter
#define _LCDML_CONTROL_analog_enter_max 920
#define _LCDML_CONTROL_analog_up_min 520 // Button Up
#define _LCDML_CONTROL_analog_up_max 590
#define _LCDML_CONTROL_analog_down_min 700 // Button Down
#define _LCDML_CONTROL_analog_down_max 770
#define _LCDML_CONTROL_analog_back_min 950 // Button Back
#define _LCDML_CONTROL_analog_back_max 1020
#define _LCDML_CONTROL_analog_left_min 430 // Button Left
#define _LCDML_CONTROL_analog_left_max 500
#define _LCDML_CONTROL_analog_right_min 610 // Button Right
#define _LCDML_CONTROL_analog_right_max 680
// *********************************************************************
void lcdml_menu_control(void)
{
// If something must init, put in in the setup condition
if(LCDML.BT_setup()) {
// runs only once
}
// check debounce timer
if((millis() - g_LCDML_DISP_press_time) >= 200) {
g_LCDML_DISP_press_time = millis(); // reset debounce timer
uint16_t value = analogRead(_LCDML_CONTROL_analog_pin); // analog pin for keypad
if (value >= _LCDML_CONTROL_analog_enter_min && value <= _LCDML_CONTROL_analog_enter_max) { LCDML.BT_enter(); }
if (value >= _LCDML_CONTROL_analog_up_min && value <= _LCDML_CONTROL_analog_up_max) { LCDML.BT_up(); }
if (value >= _LCDML_CONTROL_analog_down_min && value <= _LCDML_CONTROL_analog_down_max) { LCDML.BT_down(); }
if (value >= _LCDML_CONTROL_analog_left_min && value <= _LCDML_CONTROL_analog_left_max) { LCDML.BT_left(); }
if (value >= _LCDML_CONTROL_analog_right_min && value <= _LCDML_CONTROL_analog_right_max) { LCDML.BT_right(); }
if (value >= _LCDML_CONTROL_analog_back_min && value <= _LCDML_CONTROL_analog_back_max) { LCDML.BT_quit(); }
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
// *********************************************************************
// *************** (2) CONTROL OVER DIGITAL PINS ***********************
// *********************************************************************
#elif(_LCDML_CONTROL_cfg == 2)
// settings
unsigned long g_LCDML_DISP_press_time = 0;
#define _LCDML_CONTROL_digital_low_active 0 // 0 = high active (pulldown) button, 1 = low active (pullup)
// http://playground.arduino.cc/CommonTopics/PullUpDownResistor
#define _LCDML_CONTROL_digital_enable_quit 1
#define _LCDML_CONTROL_digital_enable_lr 1
#define _LCDML_CONTROL_digital_enter 8
#define _LCDML_CONTROL_digital_up 9
#define _LCDML_CONTROL_digital_down 10
#define _LCDML_CONTROL_digital_quit 11
#define _LCDML_CONTROL_digital_left 12
#define _LCDML_CONTROL_digital_right 13
// *********************************************************************
void lcdml_menu_control(void)
{
// If something must init, put in in the setup condition
if(LCDML.BT_setup()) {
// runs only once
// init buttons
pinMode(_LCDML_CONTROL_digital_enter , INPUT_PULLUP);
pinMode(_LCDML_CONTROL_digital_up , INPUT_PULLUP);
pinMode(_LCDML_CONTROL_digital_down , INPUT_PULLUP);
# if(_LCDML_CONTROL_digital_enable_quit == 1)
pinMode(_LCDML_CONTROL_digital_quit , INPUT_PULLUP);
# endif
# if(_LCDML_CONTROL_digital_enable_lr == 1)
pinMode(_LCDML_CONTROL_digital_left , INPUT_PULLUP);
pinMode(_LCDML_CONTROL_digital_right , INPUT_PULLUP);
# endif
}
#if(_LCDML_CONTROL_digital_low_active == 1)
# define _LCDML_CONTROL_digital_a !
#else
# define _LCDML_CONTROL_digital_a
#endif
uint8_t but_stat = 0x00;
bitWrite(but_stat, 0, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_enter)));
bitWrite(but_stat, 1, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_up)));
bitWrite(but_stat, 2, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_down)));
#if(_LCDML_CONTROL_digital_enable_quit == 1)
bitWrite(but_stat, 3, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_quit)));
#endif
#if(_LCDML_CONTROL_digital_enable_lr == 1)
bitWrite(but_stat, 4, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_left)));
bitWrite(but_stat, 5, _LCDML_CONTROL_digital_a(digitalRead(_LCDML_CONTROL_digital_right)));
#endif
if (but_stat > 0) {
if((millis() - g_LCDML_DISP_press_time) >= 200) {
g_LCDML_DISP_press_time = millis(); // reset press time
if (bitRead(but_stat, 0)) { LCDML.BT_enter(); }
if (bitRead(but_stat, 1)) { LCDML.BT_up(); }
if (bitRead(but_stat, 2)) { LCDML.BT_down(); }
if (bitRead(but_stat, 3)) { LCDML.BT_quit(); }
if (bitRead(but_stat, 4)) { LCDML.BT_left(); }
if (bitRead(but_stat, 5)) { LCDML.BT_right(); }
}
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
// *********************************************************************
// *************** (3) CONTROL WITH ENCODER ****************************
// *********************************************************************
#elif(_LCDML_CONTROL_cfg == 3)
/*
* Thanks to "MuchMore" (Arduino forum) to add this encoder functionality
*
* rotate left = Up
* rotate right = Down
* push = Enter
* push long = Quit
* push + rotate left = Left
* push + rotate right = Right
*/
/* encoder connection
* button * (do not use an external resistor, the internal pullup resistor is used)
* .-------o Arduino Pin
* |
* |
* o /
* /
* /
* o
* |
* '-------o GND
*
* encoder * (do not use an external resistor, the internal pullup resistors are used)
*
* .---------------o Arduino Pin A
* | .------o Arduino Pin B
* | |
* o / o /
* / /
* / /
* o o
* | |
* '--------o----o GND (common pin)
*/
// global defines
#define encoder_A_pin 20 // physical pin has to be 2 or 3 to use interrupts (on mega e.g. 20 or 21), use internal pullups
#define encoder_B_pin 21 // physical pin has to be 2 or 3 to use interrupts (on mega e.g. 20 or 21), use internal pullups
#define encoder_button_pin 49 // physical pin , use internal pullup
#define g_LCDML_CONTROL_button_long_press 800 // ms
#define g_LCDML_CONTROL_button_short_press 120 // ms
#define ENCODER_OPTIMIZE_INTERRUPTS //Only when using pin2/3 (or 20/21 on mega)
#include <Encoder.h> //for Encoder Download: https://github.com/PaulStoffregen/Encoder
Encoder ENCODER(encoder_A_pin, encoder_B_pin);
unsigned long g_LCDML_CONTROL_button_press_time = millis();
bool g_LCDML_CONTROL_button_prev = HIGH;
// *********************************************************************
void lcdml_menu_control(void)
// *********************************************************************
{
// declare variable for this function
int32_t g_LCDML_CONTROL_Encoder_position = ENCODER.read();
bool g_LCDML_button = digitalRead(encoder_button_pin);
// If something must init, put in in the setup condition
if(LCDML.BT_setup())
{
// runs only once
// init pins, enable pullups
pinMode(encoder_A_pin , INPUT_PULLUP);
pinMode(encoder_B_pin , INPUT_PULLUP);
pinMode(encoder_button_pin , INPUT_PULLUP);
}
// check if encoder is rotated on direction A
if(g_LCDML_CONTROL_Encoder_position <= -3)
{
// check if the button is pressed and the encoder is rotated
// the button is low active
if(g_LCDML_button == LOW)
{
// button is pressed
LCDML.BT_left();
// reset button press time for next detection
g_LCDML_CONTROL_button_prev = HIGH;
}
else
{
LCDML.BT_down();
}
// init encoder for the next step
ENCODER.write(g_LCDML_CONTROL_Encoder_position+4);
}
// check if encoder is rotated on direction B
else if(g_LCDML_CONTROL_Encoder_position >= 3)
{
// check if the button is pressed and the encoder is rotated
// the button is low active
if(g_LCDML_button == LOW)
{
// button is pressed
LCDML.BT_right();
// reset button press time for next detection
g_LCDML_CONTROL_button_prev = HIGH;
}
else
{
LCDML.BT_up();
}
// init encoder for the next step
ENCODER.write(g_LCDML_CONTROL_Encoder_position-4);
}
else
{
// check if the button was pressed for a shortly time or a long time
//falling edge, button pressed, no action
if(g_LCDML_button == LOW && g_LCDML_CONTROL_button_prev == HIGH)
{
g_LCDML_CONTROL_button_prev = LOW;
g_LCDML_CONTROL_button_press_time = millis();
}
// rising edge, button not pressed, check how long was it pressed
else if(g_LCDML_button == HIGH && g_LCDML_CONTROL_button_prev == LOW)
{
g_LCDML_CONTROL_button_prev = HIGH;
// check how long was the button pressed and detect a long press or a short press
// check long press situation
if((millis() - g_LCDML_CONTROL_button_press_time) >= g_LCDML_CONTROL_button_long_press)
{
// long press detected
LCDML.BT_quit();
}
// check short press situation
else if((millis() - g_LCDML_CONTROL_button_press_time) >= g_LCDML_CONTROL_button_short_press)
{
// short press detected
LCDML.BT_enter();
}
}
// do nothing
else
{
// do nothing
}
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
// *********************************************************************
// *************** (4) CONTROL WITH A KEYPAD ***************************
// *********************************************************************
#elif(_LCDML_CONTROL_cfg == 4)
// include
// more information under http://playground.arduino.cc/Main/KeypadTutorial
#include <Keypad.h>
// settings
#define _LCDML_CONTROL_keypad_rows 4 // Four rows
#define _LCDML_CONTROL_keypad_cols 3 // Three columns
// global vars
char keys[_LCDML_CONTROL_keypad_rows][_LCDML_CONTROL_keypad_cols] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'#','0','*'}
};
byte rowPins[_LCDML_CONTROL_keypad_rows] = { 9, 8, 7, 6 }; // Connect keypad COL0, COL1 and COL2 to these Arduino pins.
byte colPins[_LCDML_CONTROL_keypad_cols] = { 12, 11, 10 }; // Create the Keypad
// objects
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, _LCDML_CONTROL_keypad_rows, _LCDML_CONTROL_keypad_cols );
// *********************************************************************
void lcdml_menu_control(void)
{
// If something must init, put in in the setup condition
if(LCDML.BT_setup()) {
// runs only once
}
char key = kpd.getKey();
if(key) // Check for a valid key.
{
switch (key)
{
// this is the default configuration
case '#': LCDML.BT_enter(); break;
case '2': LCDML.BT_up(); break;
case '8': LCDML.BT_down(); break;
case '4': LCDML.BT_left(); break;
case '6': LCDML.BT_right(); break;
case '*': LCDML.BT_quit(); break;
// when you want to use all characters you have to use the CE_ functionality
// CE stands for "custom event" and you can define 64 evetns
// the following code is only an example
/*
case '1': LCDML.CE_set(2); break;
case '2': LCDML.CE_set(3); LCDML.BT_up(); break;
case '3': LCDML.CE_set(4); break;
case '4': LCDML.CE_set(5); LCDML.BT_left(); break;
case '5': LCDML.CE_set(6); break;
case '6': LCDML.CE_set(7); LCDML.BT_right(); break;
case '7': LCDML.CE_set(8); break;
case '8': LCDML.CE_set(9); LCDML.BT_down(); break;
case '9': LCDML.CE_set(10); break;
case '0': LCDML.CE_set(1); break;
case '#': LCDML.CE_set(12); LCDML.BT_enter(); break;
case '*': LCDML.CE_set(11); LCDML.BT_quit(); break;
*/
default: break;
}
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
// *********************************************************************
// *************** (5) CONTROL WITH IR REMOTE ***************************
// *********************************************************************
#elif(_LCDML_CONTROL_cfg == 5)
// IR include (this lib have to be installed)
// Download path: https://github.com/ukw100/IRMP
#define IRMP_INPUT_PIN PA0
#define IRMP_PROTOCOL_NAMES 1 // Enable protocol number mapping to protocol strings - needs some FLASH. Must before #include <irmp*>
#include <irmpSelectMain15Protocols.h> // This enables 15 main protocols
#include <irmp.c.h>
IRMP_DATA irmp_data[1];
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
void handleReceivedIRData();
// *********************************************************************
// change in this function the IR values to your values
void lcdml_menu_control(void)
{
// If something must init, put in in the setup condition
if(LCDML.BT_setup()) {
// runs only once
irmp_init();
}
if (irmp_get_data(&irmp_data[0]))
{
// comment this line out, to check the correct code
//Serial.println(results.value, HEX);
// in this switch case you have to change the value 0x...1 to the correct IR code
switch (irmp_data[0].command)
{
case 0x52: LCDML.BT_enter(); break;
case 0x50: LCDML.BT_up(); break;
case 0x51: LCDML.BT_down(); break;
case 0x55: LCDML.BT_left(); break;
case 0x56: LCDML.BT_right(); break;
case 0x23: LCDML.BT_quit(); break;
default: break;
}
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
// *********************************************************************
// *************** (6) CONTROL OVER JOYSTICK ***************************
// *********************************************************************
#elif(_LCDML_CONTROL_cfg == 6)
unsigned long g_LCDML_DISP_press_time = 0;
// settings
#define _LCDML_CONTROL_analog_pinx A0
#define _LCDML_CONTROL_analog_piny A1
#define _LCDML_CONTROL_digitalread 33 //don't work with u8glib
// when you did not use a button set the value to zero
#define _LCDML_CONTROL_analog_up_min 612 // Button Up
#define _LCDML_CONTROL_analog_up_max 1023
#define _LCDML_CONTROL_analog_down_min 0 // Button Down
#define _LCDML_CONTROL_analog_down_max 412
#define _LCDML_CONTROL_analog_left_min 612 // Button Left
#define _LCDML_CONTROL_analog_left_max 1023
#define _LCDML_CONTROL_analog_right_min 0 // Button Right
#define _LCDML_CONTROL_analog_right_max 412
// *********************************************************************
void lcdml_menu_control(void)
{
// If something must init, put in in the setup condition
if(LCDML.BT_setup()) {
// runs only once
pinMode (_LCDML_CONTROL_digitalread, INPUT);
}
// check debounce timer
if((millis() - g_LCDML_DISP_press_time) >= 200) {
g_LCDML_DISP_press_time = millis(); // reset debounce timer
uint16_t valuex = analogRead(_LCDML_CONTROL_analog_pinx); // analogpinx
uint16_t valuey = analogRead(_LCDML_CONTROL_analog_piny); // analogpinx
uint16_t valuee = digitalRead(_LCDML_CONTROL_digitalread); //digitalpinenter
if (valuey >= _LCDML_CONTROL_analog_up_min && valuey <= _LCDML_CONTROL_analog_up_max) { LCDML.BT_up(); } // up
if (valuey >= _LCDML_CONTROL_analog_down_min && valuey <= _LCDML_CONTROL_analog_down_max) { LCDML.BT_down(); } // down
if (valuex >= _LCDML_CONTROL_analog_left_min && valuex <= _LCDML_CONTROL_analog_left_max) { LCDML.BT_left(); } // left
if (valuex >= _LCDML_CONTROL_analog_right_min && valuex <= _LCDML_CONTROL_analog_right_max) { LCDML.BT_right(); } // right
if(valuee == true) {LCDML.BT_enter();} // enter
// back buttons have to be included as menu item
// lock at the example LCDML_back_button
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
// *********************************************************************
// *************** (7) CONTROL OVER PCF8574 ****************************
// *********************************************************************
#elif(_LCDML_CONTROL_cfg == 7)
unsigned long g_LCDML_DISP_press_time = 0;
#define PCF8574_1 0x26 // I2C address for the buttons
#define PCF8574_Pin0 254
#define PCF8574_Pin1 253
#define PCF8574_Pin2 251
#define PCF8574_Pin3 247
#define PCF8574_Pin4 239
#define PCF8574_Pin5 223
#define PCF8574_Pin6 191
#define PCF8574_Pin7 127
// Specify the PCF8574 pins here
#define _LCDML_CONTROL_PCF8574_enable_quit 0
#define _LCDML_CONTROL_PCF8574_enable_lr 0
#define _LCDML_CONTROL_PCF8574_enter PCF8574_Pin0
#define _LCDML_CONTROL_PCF8574_up PCF8574_Pin1
#define _LCDML_CONTROL_PCF8574_down PCF8574_Pin2
#define _LCDML_CONTROL_PCF8574_left PCF8574_Pin3
#define _LCDML_CONTROL_PCF8574_right PCF8574_Pin4
#define _LCDML_CONTROL_PCF8574_quit PCF8574_Pin5
// **********************************************************
void lcdml_menu_control(void)
{
// If something must init, put in in the setup condition
if(LCDML.BT_setup()) {
// runs only once
}
if((millis() - g_LCDML_DISP_press_time) >= 200) {
g_LCDML_DISP_press_time = millis(); // reset press time
Wire.write(0xff); // All pins as input?
Wire.requestFrom(PCF8574_1, 1);
if (Wire.available()) {
switch (Wire.read())
{
case _LCDML_CONTROL_PCF8574_enter: LCDML.BT_enter(); break;
case _LCDML_CONTROL_PCF8574_up: LCDML.BT_up(); break;
case _LCDML_CONTROL_PCF8574_down: LCDML.BT_down(); break;
#if(_LCDML_CONTROL_PCF8574_enable_quit == 1)
case _LCDML_CONTROL_PCF8574_quit: LCDML.BT_quit(); break;
#endif
#if(_LCDML_CONTROL_PCF8574_enable_lr == 1)
case _LCDML_CONTROL_PCF8574_left: LCDML.BT_left(); break;
case _LCDML_CONTROL_PCF8574_right: LCDML.BT_right(); break;
#endif
default: break;
}
}
}
}
// *********************************************************************
// ******************************* END *********************************
// *********************************************************************
#else
#error _LCDML_CONTROL_cfg is not defined or not in range
#endif

@ -4,7 +4,7 @@
#
# MIT License
#
# Copyright (c) [2020] [Nils Feldkämper]
# Copyright (c) [2021] [Nils Feldkämper]
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -178,8 +178,10 @@ _LCDML_DISP_cfg_cursor LITERAL1
_LCDML_DISP_cnt LITERAL1
_LCDML_TYPE_dynParam LITERAL1
_LCDML_TYPE_default LITERAL1
_LCDML_TYPE_dynParam LITERAL1
_LCDML_TYPE_dynParam_enableSubMenus LITERAL1
_LCDML_TYPE_dynParam_enableCustomRefresh LITERAL1
LCDML_UNUSED LITERAL1
@ -197,6 +199,8 @@ callback KEYWORD2
checkCondition KEYWORD2
checkType_menu KEYWORD2
checkType_dynParam KEYWORD2
checkType_dynParam_enabledSubMenu KEYWORD2
checkType_dynParam_enabledCustomRefresh KEYWORD2
#######################################
@ -215,6 +219,7 @@ MENU_getLayer KEYWORD2
MENU_getCursorPos KEYWORD2
MENU_getChilds KEYWORD2
MENU_getCursorPosAbs KEYWORD2
MENU_getCursorObjPos KEYWORD2
MENU_getParentID KEYWORD2
MENU_enRollover KEYWORD2
MENU_disRollover KEYWORD2
@ -224,6 +229,8 @@ MENU_getRootObj KEYWORD2
MENU_getScroll KEYWORD2
MENU_enScroll KEYWORD2
MENU_disScroll KEYWORD2
MENU_enUseDynElementsWithSubElements KEYWORD2
MENU_disUseDynElementsWithSubElements KEYWORD2
MENU_getScrollDisableStatus KEYWORD2
MENU_setDynContent KEYWORD2
MENU_checkDynContent KEYWORD2
@ -234,6 +241,11 @@ MENU_getElementIDFromCursorPos KEYWORD2
MENU_setDynFunctionContentUpdate KEYWORD2
MENU_clearDynFunctionContentUpdate KEYWORD2
MENU_allCondetionRefresh KEYWORD2
MENU_enRefreshAllOnButtonAction KEYWORD2
MENU_disRefreshAllOnButtonAction KEYWORD2
MENU_setDynRContent KEYWORD2
MENU_clearDynRContent KEYWORD2
MENU_checkDynRContent KEYWORD2
BT_setup KEYWORD2
BT_enter KEYWORD2

@ -1,7 +1,7 @@
name=LCDMenuLib2
version=2.2.6
author=Nils Feldkaemper <nilsfeld@gmail.com>
maintainer=Nils Feldkaemper <nilsfeld@gmail.com>
version=2.2.7
author=Nils Feldkämper
maintainer=Community https://github.com/Jomelo/LCDMenuLib2
sentence=Easy creation of a multi layer tree menu with screensaver and other stuff.
paragraph=Examples for the basic function and different output types [console (serial monitor), lcd displays, glcd displays, gfx displays]
category=Display

@ -4,7 +4,7 @@
*
* MIT License
*
* Copyright (c) [2020] [Nils Feldkämper]
* Copyright (c) [2021] [Nils Feldkämper]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -99,7 +99,7 @@ void LCDMenuLib2::init(uint8_t p_last_element_id)
// paramter 10 => do not scroll
MENU_doScroll(10);
// update the menu
MENU_display();
bitSet(REG_update, _LCDML_REG_update_menu);
DISP_menuUpdate();
}
@ -397,8 +397,7 @@ void LCDMenuLib2::loop_menu(void)
MENU_enScroll();
bitClear(REG_special, _LCDML_REG_special_OTHER_function_active);
bitClear(REG_control, _LCDML_REG_control_dynMenuDisplayed);
bitClear(REG_special, _LCDML_REG_special_OTHER_function_active);
// stop running function and go back to the menu
if(actMenu_id != _LCDML_NO_FUNC)
@ -823,21 +822,52 @@ void LCDMenuLib2::loop_menu(void)
// do nothing
}
// update content
callback_contentUpdate();
//
// detect if dynamic refreshed content is currently displayed
// some limit values
cnt = MENU_getScroll();
uint8_t maxi = window_rows + cnt;
MENU_clearDynRContent();
REG_button = 0;
if ((tmp = MENU_getDisplayedObj()) != NULL)
{
// loop to display lines
do
{
// check if a menu element has a condition and if the condition be true
if (tmp->checkCondition())
{
// call a dyn content element
if(tmp->checkType_dynParam_enabledCustomRefresh() == true)
{
// new function in version 2.2.7 to set a flag that dynamic enabled content is displayed
MENU_setDynRContent();
break;
}
// increment some values
cnt++;
}
// try to go to the next sibling and check the number of displayed rows
} while (((tmp = tmp->getSibling(1)) != NULL) && (cnt < maxi));
}
// end of detection of dynamic refreshed content
// update content
callback_contentUpdate();
REG_button = 0;
// this update function is neccessary for dynamic contents when a low element in the menu update the content of
// a higher element
if(bitRead(REG_update, _LCDML_REG_update_update_dyn_content) == true)
{
// force a rebuild of the menu output content and cursor position
MENU_display();
bitSet(REG_update, _LCDML_REG_update_menu);
bitSet(REG_update, _LCDML_REG_update_cursor);
// update content without button handling
callback_contentUpdate();
callback_contentUpdate();
// clear this flag
MENU_clearDynFunctionContentUpdate();
}
@ -926,7 +956,7 @@ void LCDMenuLib2::MENU_goRoot(void)
MENU_initFirstElement();
MENU_doScroll(10);
MENU_display();
bitSet(REG_update, _LCDML_REG_update_menu);
}
}
@ -1054,22 +1084,25 @@ void LCDMenuLib2::MENU_goInto(void)
if (actMenu_id == _LCDML_NO_FUNC)
{
// check if element is a menu function
if(curMenu->getChild(cursor_obj_pos)->getChild(0) == NULL && curMenu->getChild(cursor_obj_pos)->checkType_menu() == true)
//if(curMenu->getChild(cursor_obj_pos)->checkCallback() == true && curMenu->getChild(cursor_obj_pos)->checkType_menu() == true)
if(curMenu->getChild(cursor_obj_pos)->getChild(0) == NULL // no children
&& curMenu->getChild(cursor_obj_pos)->checkType_menu() == true // menu element
&& curMenu->getChild(cursor_obj_pos)->getCbFunction() != LCDML_cb_default_function) // default call back function
{
// Menu function found
actMenu_cb_function = curMenu->getChild(cursor_obj_pos)->getCbFunction();
actMenu_id = curMenu->getChild(cursor_obj_pos)->getID();
actMenu_param = curMenu->getChild(cursor_obj_pos)->getParam();
actMenu_param = curMenu->getChild(cursor_obj_pos)->getParam();
}
else
{
if(curMenu->getChild(cursor_obj_pos)->checkType_dynParam() == true)
if(curMenu->getChild(cursor_obj_pos)->checkType_dynParam() == true // dynamic menu element
&& curMenu->getChild(cursor_obj_pos)->checkType_dynParam_enabledSubMenu() == false // submenus disabled
&& bitRead(REG_control, _LCDML_REG_control_en_use_dyn_elements_as_menu) == false) // dyn sub menus general disabled
{
DISP_update();
}
else
{
{
if(curMenu->getChild(cursor_obj_pos)->getChild(0) != NULL)
{
//check if element has visible children
@ -1098,7 +1131,10 @@ void LCDMenuLib2::MENU_goInto(void)
}
else
{
// do nothing
if(curMenu->getChild(cursor_obj_pos)->checkType_dynParam() == true)
{
DISP_update();
}
}
}
}
@ -1212,16 +1248,11 @@ LCDMenuLib2_menu * LCDMenuLib2::MENU_getDisplayedObj(void)
void LCDMenuLib2::MENU_display(uint8_t update)
/* ******************************************************************** */
{
// update is unused because of compatibility it is not removed
LCDML_UNUSED(update);
// debug information
DBG_println(LCDML_DBG_function_name_MENU, F("LCDML.MENU_display"));
//check children
bitSet(REG_update, _LCDML_REG_update_menu);
bitSet(REG_update, _LCDML_REG_update_menu);
}
/* ******************************************************************** */
@ -1252,8 +1283,6 @@ void LCDMenuLib2::MENU_doScroll(uint8_t state)
// 0 = scroll up
// 1 = scroll down
// 10 = update cursor postion
switch(state)
{
case 0: // up
@ -1272,12 +1301,11 @@ void LCDMenuLib2::MENU_doScroll(uint8_t state)
{
cursor_pos_abs--;
cursor_obj_pos = last_valid_obj_pos;
//update = true;
}
else
{
// rollover is possible
rollover = true;
rollover = true;
}
break;
}
@ -1286,8 +1314,7 @@ void LCDMenuLib2::MENU_doScroll(uint8_t state)
if(tmp->checkCondition() == true)
{
cnt_visible++;
last_valid_obj_pos = obj_pos;
//update = true;
last_valid_obj_pos = obj_pos;
}
else
{
@ -1320,8 +1347,7 @@ void LCDMenuLib2::MENU_doScroll(uint8_t state)
if(tmp->checkCondition() == true)
{
cnt_visible++;
last_valid_obj_pos = obj_pos;
//update = true;
last_valid_obj_pos = obj_pos;
}
else
{
@ -1337,6 +1363,8 @@ void LCDMenuLib2::MENU_doScroll(uint8_t state)
if(cursor_pos_abs - (window_rows-1) > 0)
{
window_start = cursor_pos_abs-(window_rows-1);
// update menu content when window is moved
bitSet(REG_update, _LCDML_REG_update_menu);
}
else
{
@ -1353,15 +1381,9 @@ void LCDMenuLib2::MENU_doScroll(uint8_t state)
// do nothing
}
bitClear(REG_button, _LCDML_REG_button_up);
// reset the button state here or update the menu
bitSet(REG_update, _LCDML_REG_update_menu);
bitClear(REG_button, _LCDML_REG_button_up);
break;
case 1: // down
obj_pos = cursor_obj_pos;
@ -1379,7 +1401,6 @@ void LCDMenuLib2::MENU_doScroll(uint8_t state)
cnt_visible++;
cursor_pos_abs++;
cursor_obj_pos = obj_pos;
//update = true;
break;
}
else
@ -1404,6 +1425,8 @@ void LCDMenuLib2::MENU_doScroll(uint8_t state)
cursor_pos_abs = 0;
window_start = 0;
MENU_initFirstElement();
// update menu content
bitSet(REG_update, _LCDML_REG_update_menu);
}
else
{
@ -1411,8 +1434,7 @@ void LCDMenuLib2::MENU_doScroll(uint8_t state)
}
// reset the button state here and update the menu
bitClear(REG_button, _LCDML_REG_button_down);
bitSet(REG_update, _LCDML_REG_update_menu);
bitClear(REG_button, _LCDML_REG_button_down);
break;
@ -1422,7 +1444,7 @@ void LCDMenuLib2::MENU_doScroll(uint8_t state)
}
// update window possition
// only update the window position when no the menu is not rolled over
// only update the window position when the menu is not rolled over
if(rollover == false)
{
if(cursor_pos_abs - (window_rows-1) > 0 || window_start > 0)
@ -1435,6 +1457,8 @@ void LCDMenuLib2::MENU_doScroll(uint8_t state)
if(window_start > 0)
{
window_start--;
// update menu content when window is moved
bitSet(REG_update, _LCDML_REG_update_menu);
}
else
{
@ -1451,6 +1475,8 @@ void LCDMenuLib2::MENU_doScroll(uint8_t state)
if(cursor_pos == (window_rows-1))
{
window_start = cursor_pos_abs - (window_rows-1);
// update menu content when window is moved
bitSet(REG_update, _LCDML_REG_update_menu);
}
else
{
@ -1478,7 +1504,11 @@ void LCDMenuLib2::MENU_doScroll(uint8_t state)
// check if the cursor position is updated
if(actMenu_id == _LCDML_NO_FUNC)
{
bitSet(REG_update, _LCDML_REG_update_cursor);
bitSet(REG_update, _LCDML_REG_update_cursor);
if(bitRead(REG_update, _LCDML_REG_control_refresh_all_on_button_action) == true)
{
bitSet(REG_update, _LCDML_REG_update_menu);
}
}
else
{
@ -1506,6 +1536,26 @@ void LCDMenuLib2::MENU_disRollover(void)
bitClear(REG_control, _LCDML_REG_control_rollover);
}
/* ******************************************************************** */
void LCDMenuLib2::MENU_enUseDynElementsWithSubElements(void)
/* ******************************************************************** */
{
// debug information
DBG_println(LCDML_DBG_function_name_MENU, F("LCDML.MENU_enUseDynElementsWithSubElements"));
bitSet(REG_control, _LCDML_REG_control_en_use_dyn_elements_as_menu);
}
/* ******************************************************************** */
void LCDMenuLib2::MENU_disUseDynElementsWithSubElements(void)
/* ******************************************************************** */
{
// debug information
DBG_println(LCDML_DBG_function_name_MENU, F("LCDML.MENU_disUseDynElementsWithSubElements"));
bitClear(REG_control, _LCDML_REG_control_en_use_dyn_elements_as_menu);
}
/* ******************************************************************** */
uint8_t LCDMenuLib2::MENU_getLayer(void)
/* ******************************************************************** */
@ -1536,6 +1586,16 @@ uint8_t LCDMenuLib2::MENU_getCursorPosAbs(void)
return cursor_pos_abs; //return the current cursor position
}
/* ******************************************************************** */
uint8_t LCDMenuLib2::MENU_getCursorObjPos(void)
/* ******************************************************************** */
{
// debug information
DBG_println(LCDML_DBG_function_name_MENU, F("LCDML.MENU_getCursorObjPos"));
return cursor_obj_pos; //return the current cursor position
}
/* ******************************************************************** */
uint8_t LCDMenuLib2::MENU_countChilds(LCDMenuLib2_menu *menu, uint8_t all)
/* ******************************************************************** */
@ -1620,33 +1680,6 @@ uint8_t LCDMenuLib2::MENU_getParentID(uint8_t p_layer)
}
}
/* ******************************************************************** */
void LCDMenuLib2::MENU_setDynContent(void)
/* ******************************************************************** */
{
// debug information
DBG_println(LCDML_DBG_function_name_MENU, F("LCDML.MENU_setDynContent"));
bitSet(REG_control, _LCDML_REG_control_dynMenuDisplayed);
}
/* ******************************************************************** */
uint8_t LCDMenuLib2::MENU_checkDynContent(void)
/* ******************************************************************** */
{
// debug information
DBG_println(LCDML_DBG_function_name_MENU, F("LCDML.MENU_checkDynContent"));
if(bitRead(REG_control, _LCDML_REG_control_dynMenuDisplayed))
{
return true;
}
else
{
return false;
}
}
/* ******************************************************************** */
void LCDMenuLib2::MENU_enScroll(void)
/* ******************************************************************** */
@ -1854,6 +1887,61 @@ void LCDMenuLib2::MENU_allCondetionRefresh(void)
}
/* ******************************************************************** */
void LCDMenuLib2::MENU_enRefreshAllOnButtonAction(void)
/* ******************************************************************** */
{
// debug information
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.MENU_enRefreshAllOnButtonAction"));
bitSet(REG_control, _LCDML_REG_control_refresh_all_on_button_action);
}
/* ******************************************************************** */
void LCDMenuLib2::MENU_disRefreshAllOnButtonAction(void)
/* ******************************************************************** */
{
// debug information
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.MENU_disRefreshAllOnButtonAction"));
bitClear(REG_control, _LCDML_REG_control_refresh_all_on_button_action);
}
/* ******************************************************************** */
void LCDMenuLib2::MENU_setDynRContent(void)
/* ******************************************************************** */
{
// debug information
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.MENU_setDynRContent"));
bitSet(REG_control, _LCDML_REG_control_content_ref_is_displayed);
}
/* ******************************************************************** */
void LCDMenuLib2::MENU_clearDynRContent(void)
/* ******************************************************************** */
{
// debug information
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.MENU_clearDynRContent"));
bitClear(REG_control, _LCDML_REG_control_content_ref_is_displayed);
}
/* ******************************************************************** */
bool LCDMenuLib2::MENU_checkDynRContent(void)
/* ******************************************************************** */
{
// debug information
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.MENU_checkDynRContent"));
return bitRead(REG_control, _LCDML_REG_control_content_ref_is_displayed);
}
/* ******************************************************************** */
/* ******************************************************************** */
/* DISP methods */
@ -1891,7 +1979,6 @@ bool LCDMenuLib2::DISP_checkMenuUpdate(void)
if (bitRead(REG_update, _LCDML_REG_update_menu))
{
bitClear(REG_update, _LCDML_REG_update_menu);
bitClear(REG_control, _LCDML_REG_control_dynMenuDisplayed);
return true;
}
else
@ -1926,9 +2013,8 @@ void LCDMenuLib2::DISP_update(void)
DBG_println(LCDML_DBG_function_name_DISP, F("LCDML.DISP_update"));
MENU_doScroll(10);
MENU_display();
bitSet(REG_update, _LCDML_REG_update_menu);
bitSet(REG_update, _LCDML_REG_update_menu);
}
@ -2475,32 +2561,33 @@ void LCDMenuLib2::OTHER_jumpToFunc(LCDML_FuncPtr_pu8 p_search, uint8_t p_para)
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.OTHER_jumpToFunc"));
if(p_search == NULL)
{
{
// debug information
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.OTHER_jumpToFunc - no function selected"));
}
else
{
{
if(bitRead(REG_special, _LCDML_REG_special_OTHER_function_active) == true)
{
{
// debug information
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.OTHER_jumpToFunc - is still activ"));
}
else
{
{
// check if this menu function is active - do nothing
if(p_search == actMenu_cb_function)
{
{
// debug information
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.OTHER_jumpToFunc - function is still running"));
}
else
{
{
// debug information
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.OTHER_jumpToFunc - start"));
bitSet(REG_special, _LCDML_REG_special_OTHER_function_active);
bitClear(REG_special, _LCDML_REG_special_setCursorTo);
MENU_clearDynRContent();
// Save last active Menu ID
actMenu_lastFuncID = actMenu_id;
@ -2559,7 +2646,8 @@ void LCDMenuLib2::OTHER_jumpToID(uint8_t p_id, uint8_t p_para)
DBG_println(LCDML_DBG_function_name_OTHER, F("LCDML.OTHER_jumpToID - start"));
bitSet(REG_special, _LCDML_REG_special_OTHER_function_active);
bitClear(REG_special, _LCDML_REG_special_setCursorTo);
bitClear(REG_special, _LCDML_REG_special_setCursorTo);
MENU_clearDynRContent();
// Save last active Menu ID
actMenu_lastFuncID = actMenu_id;
@ -2623,6 +2711,7 @@ void LCDMenuLib2::OTHER_setCursorToFunc(LCDML_FuncPtr_pu8 p_search)
// enable jump to Func
bitSet(REG_special, _LCDML_REG_special_OTHER_function_active);
bitSet(REG_special, _LCDML_REG_special_setCursorTo);
MENU_clearDynRContent();
jT_id = 0;
// Save last active Menu ID
@ -2674,6 +2763,7 @@ void LCDMenuLib2::OTHER_setCursorToID(uint8_t p_id)
// enable jump to Func
bitSet(REG_special, _LCDML_REG_special_OTHER_function_active);
bitSet(REG_special, _LCDML_REG_special_setCursorTo);
MENU_clearDynRContent();
jT_id = p_id;
// Save last active Menu ID

@ -4,7 +4,7 @@
*
* MIT License
*
* Copyright (c) [2020] [Nils Feldkämper]
* Copyright (c) [2021] [Nils Feldkämper]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -80,9 +80,9 @@
#endif
// Version
#define _LCDML_VERSION "LCDML2 v2.2.6"
#define _LCDML_VERSION "LCDML2 v2.2.7"
// this makro is for unused variables which exists for compatibility tings ...
// this makro is for unused variables which exists for compatibility things ...
#define LCDML_UNUSED(expr) do { (void)(expr); } while (0)
// Include Arduino ios
@ -90,7 +90,7 @@
// Arduino specific settings
#if ARDUINO >= 160
#define _LCDMenuLib2_arduino_version 1 // for new Arduino version like 1.6.0 or higher
#define _LCDMenuLib2_arduino_version 1 // for new Arduino version like 1.6.0 and higher
#else
#define _LCDMenuLib2_arduino_version 0 // for old Arduino version like 1.0.6 or 1.0.5
#endif
@ -110,19 +110,19 @@
#define _LCDML_FIRST_ELEMENT_ID 255
// Bit pos control flags
#define _LCDML_REG_control_dynMenuDisplayed 7
#define _LCDML_REG_control_free_7 7
#define _LCDML_REG_control_ce_init_setup 6
#define _LCDML_REG_control_free_5 5
#define _LCDML_REG_control_content_ref_is_displayed 5
#define _LCDML_REG_control_bt_init_setup 4
#define _LCDML_REG_control_update_direct 3
#define _LCDML_REG_control_free_2 2
#define _LCDML_REG_control_refresh_all_on_button_action 2
#define _LCDML_REG_control_rollover 1
#define _LCDML_REG_control_free_0 0
#define _LCDML_REG_control_en_use_dyn_elements_as_menu 0
// screensaver, jump to function, go Root, ...
#define _LCDML_REG_special_setCursorTo 7
#define _LCDML_REG_special_OTHER_function_active 6
#define _LCDML_REG_special_free_5 5
#define _LCDML_REG_special_free_5 5
#define _LCDML_REG_special_free_4 4
#define _LCDML_REG_special_free_3 3
#define _LCDML_REG_special_goRoot 2
@ -250,7 +250,7 @@
void MENU_goBack(void); // move to the parent menu
void MENU_doScroll(uint8_t state); // scroll the menu
uint8_t MENU_countChilds(LCDMenuLib2_menu *menu, uint8_t all=false); // how many children exists on next layer
void MENU_initFirstElement(void); // set counter to the first object child
void MENU_initFirstElement(void); // set counter to the first object child (when first element is hidden, go to the first visible element)
void MENU_resetActiveMenu(void); // clear all neccessary variables
// callback function
@ -276,12 +276,11 @@
void MENU_disRollover(void); // disable the menu rollover function
void MENU_enScroll(void); // enable the scroll function (this function can be disabled on dyn content elements and when a encoder is used)
void MENU_disScroll(void); // disable the scroll function to catch the cursor to an dyn content element when a encoder is used
void MENU_setDynContent(void); // set this value when dyn content is shown on the current windows of the display
uint8_t MENU_checkDynContent(void); // check if dyn content is displayed
bool MENU_getScrollDisableStatus(void); // check if the scroll function is disabled
uint8_t MENU_getLayer(void); // get the current layer of the menu
uint8_t MENU_getCursorPos(void); // get the current cursor position (row 0, row 1, row 2, ...)
uint8_t MENU_getCursorPosAbs(void); // get the current cursor postion absolute (..., row 10, row 11, ..) based on the menu structure
uint8_t MENU_getCursorObjPos(void); // returns the cursor object position
uint8_t MENU_getChilds(void); // get the current number of childs on this layer
uint8_t MENU_getParentID(uint8_t p_layer=0); // get the parent id of a selected higher layer
uint8_t MENU_getScroll(void); // get the current scroll value
@ -291,7 +290,14 @@
void MENU_updateAllCondetions(void); // update all menu element condetions
void MENU_setDynFunctionContentUpdate(void); // this is a special function for dynamic content to update the dynamic content again
void MENU_clearDynFunctionContentUpdate(void); // this is a special function to clear the dynamic content update. this function is called internally
void MENU_allCondetionRefresh(void); // update all condetions
void MENU_allCondetionRefresh(void); // update all condetions
void MENU_enUseDynElementsWithSubElements(void); // enable subelements for dynamic menu elements
void MENU_disUseDynElementsWithSubElements(void); // disable subelements for dynamic menu elements
void MENU_enRefreshAllOnButtonAction(void); // enable update on every button action the complete menu
void MENU_disRefreshAllOnButtonAction(void); // disable update on every button action the complete menu
void MENU_setDynRContent(void); // enable dynamic refreshed content is shown
void MENU_clearDynRContent(void); // disable dynamic refreshed content is shown
bool MENU_checkDynRContent(void); // get dynamic refreshed content is shown
LCDMenuLib2_menu * MENU_getDisplayedObj(void); // get the objection with the current content to display
LCDMenuLib2_menu * MENU_getCurrentObj(void); // get the current menu child object

@ -4,7 +4,7 @@
*
* MIT License
*
* Copyright (c) [2020] [Nils Feldkämper]
* Copyright (c) [2021] [Nils Feldkämper]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

@ -4,7 +4,7 @@
*
* MIT License
*
* Copyright (c) [2020] [Nils Feldkämper]
* Copyright (c) [2021] [Nils Feldkämper]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -49,13 +49,7 @@ LCDMenuLib2_menu::LCDMenuLib2_menu(uint8_t p_id, uint8_t p_param, uint8_t p_conf
id = p_id; // element name
param = p_param; // element configuration
switch(p_configuration)
{
case _LCDML_TYPE_default: bitSet(REG_control, _LCDML_REG_MENU_CONTROL_type_default); break;
case _LCDML_TYPE_dynParam: bitSet(REG_control, _LCDML_REG_MENU_CONTROL_type_dynParam); break;
default:
break;
}
REG_control = p_configuration;
if(p_callback_function == NULL)
{
@ -224,3 +218,18 @@ bool LCDMenuLib2_menu::checkType_dynParam()
{
return bitRead(REG_control, _LCDML_REG_MENU_CONTROL_type_dynParam);
}
/* ******************************************************************** */
bool LCDMenuLib2_menu::checkType_dynParam_enabledSubMenu()
/* ******************************************************************** */
{
return bitRead(REG_control, _LCDML_REG_MENU_CONTROL_type_dynParam);
}
/* ******************************************************************** */
bool LCDMenuLib2_menu::checkType_dynParam_enabledCustomRefresh()
/* ******************************************************************** */
{
return bitRead(REG_control, _LCDML_REG_MENU_CONTROL_type_dynParam_enable_custom_refresh);
}

@ -4,7 +4,7 @@
*
* MIT License
*
* Copyright (c) [2020] [Nils Feldkämper]
* Copyright (c) [2021] [Nils Feldkämper]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -41,19 +41,21 @@
# include "Arduino.h"
# include "LCDMenuLib2_typedef.h"
// types for advanced menu function (this types are used by the menu element initialisation)
#define _LCDML_TYPE_dynParam 1
#define _LCDML_TYPE_default 0
// REG_control
#define _LCDML_REG_MENU_CONTROL_condetion 7
#define _LCDML_REG_MENU_CONTROL_free6 6
#define _LCDML_REG_MENU_CONTROL_free5 5
#define _LCDML_REG_MENU_CONTROL_free4 4
#define _LCDML_REG_MENU_CONTROL_free3 3
#define _LCDML_REG_MENU_CONTROL_free2 2
#define _LCDML_REG_MENU_CONTROL_type_dynParam 1
#define _LCDML_REG_MENU_CONTROL_type_default 0
#define _LCDML_REG_MENU_CONTROL_condetion 7
#define _LCDML_REG_MENU_CONTROL_free_6 6
#define _LCDML_REG_MENU_CONTROL_free_5 5
#define _LCDML_REG_MENU_CONTROL_free_4 4
#define _LCDML_REG_MENU_CONTROL_type_dynParam_enable_custom_refresh 3
#define _LCDML_REG_MENU_CONTROL_type_dynParam_enable_sub 2
#define _LCDML_REG_MENU_CONTROL_type_dynParam 1
#define _LCDML_REG_MENU_CONTROL_type_default 0
// types for advanced menu function (this types are used by the menu element initialisation)
#define _LCDML_TYPE_dynParam_enableCustomRefresh 10 //0b1010// setBit 1 & setBit 3
#define _LCDML_TYPE_dynParam_enableSubMenus 6 //0b0110// setBit 1 & setBit 2
#define _LCDML_TYPE_dynParam 2 //0b0010// setBit 1
#define _LCDML_TYPE_default 1 //0b0000// setBit 0
inline void LCDML_cb_default_function(uint8_t) { };
inline bool LCDML_cb_default_condetion(void) { return true; };
@ -87,15 +89,17 @@
LCDMenuLib2_menu * getSibling(uint8_t howfar); // Returns a pointer to the sibling how far siblings away from this menu
LCDMenuLib2_menu * getParent(); // Returns this menu's parent menu. If no parent, returns itself
uint8_t getID(); // return the id of a menu element
uint8_t getID(void); // return the id of a menu element
bool checkCondition(); // check menu display condition
void updateCondetion(); // refrech the condetion callback
bool checkCondition(void); // check menu display condition
void updateCondetion(void); // refrech the condetion callback
uint8_t getParam(); // return a parameter which is set on the initialization
uint8_t getParam(void); // return a parameter which is set on the initialization
bool checkType_menu(); // check menu type - normal menu function
bool checkType_dynParam(); // check menu type - dynamic menu function
bool checkType_menu(void); // check menu type - normal menu function
bool checkType_dynParam(void); // check menu type - dynamic menu function
bool checkType_dynParam_enabledSubMenu(void); // check menu type - dynamic menu function with sub menus
bool checkType_dynParam_enabledCustomRefresh(void); // check menu type - dynamic menu function with external custom refresh
void callback(uint8_t p); // call menu callback
};

@ -4,7 +4,7 @@
*
* MIT License
*
* Copyright (c) [2020] [Nils Feldkämper]
* Copyright (c) [2021] [Nils Feldkämper]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

@ -1 +0,0 @@
Subproject commit 4bdf02125cfbe27a3489d0157317270073d152f0
Loading…
Cancel
Save