1313#include < TaskManagerIO.h>
1414#include < IoLogging.h>
1515
16+ // We added a RAM based scroll choice item, and this references a fixed width array variable.
1617// This variable is the RAM data for scroll choice item Scroll
18+ // https://www.thecoderscorner.com/products/arduino-libraries/tc-menu/menu-item-types/scrollchoice-menu-item/
1719char ramDataSet[] = " 1\0 2\0 3\0 4\0 5\0 ~" ;
1820
1921const uint8_t myManualIp[] = { 192 , 168 , 0 , 202 };
@@ -22,6 +24,10 @@ const uint8_t standardNetMask[] = { 255, 255, 255, 0 };
2224
2325using namespace tcremote ;
2426
27+ // Here we implement the custom drawing capability of the renderer, it allows us to receive reset and custom drawing
28+ // requests. More info in the link below:
29+ // https://www.thecoderscorner.com/products/arduino-libraries/tc-menu/renderer-take-over-display/
30+ //
2531class MyCustomDrawing : public CustomDrawing {
2632private:
2733 GraphicsDeviceRenderer& dev;
@@ -69,10 +75,12 @@ public:
6975} myCustomDrawing(renderer);
7076
7177void setup () {
78+ // This example logs using IoLogging, see the following guide to enable
79+ // https://www.thecoderscorner.com/products/arduino-libraries/io-abstraction/arduino-logging-with-io-logging/
80+ IOLOG_START_SERIAL
7281 serEnableLevel (SER_NETWORK_DEBUG, true );
7382
7483 // Start up serial and prepare the correct SPI
75- Serial.begin (115200 );
7684 SPI.setMISO (PB4);
7785 SPI.setMOSI (PB5);
7886 SPI.setSCLK (PB3);
@@ -93,6 +101,8 @@ void setup() {
93101 });
94102
95103 myCustomDrawing.registerWithRenderer ();
104+
105+ // We can set a callback for when the title item is pressed on the main menu, here we just take over the display
96106 setTitlePressedCallback ([](int ) {
97107 renderer.takeOverDisplay ();
98108 });
@@ -102,8 +112,9 @@ void loop() {
102112 taskManager.runLoop ();
103113}
104114
105-
106115// see tcMenu list documentation on thecoderscorner.com
116+ // https://www.thecoderscorner.com/products/arduino-libraries/tc-menu/menu-item-types/list-menu-item/
117+ //
107118int CALLBACK_FUNCTION fnRuntimesCustomListRtCall (RuntimeMenuItem* item, uint8_t row, RenderFnMode mode, char * buffer, int bufferSize) {
108119 switch (mode) {
109120 case RENDERFN_INVOKE:
@@ -142,6 +153,11 @@ void CALLBACK_FUNCTION largeNumDidChange(int id) {
142153
143154
144155void CALLBACK_FUNCTION onDecimalStepChange (int id) {
156+ //
157+ // Analog menu items support the concept of step, that is the number of ticks forward that one detent of the
158+ // encoder represents, here we read the step enum item to get the current value, and then call setStep on the
159+ // analog item to set how much one tick moves the current value.
160+ //
145161 int stepChoice = menuDecimalStep.getCurrentValue ();
146162 int stepVal;
147163 switch (stepChoice) {
0 commit comments