Hi,
I ran into the problem that the example for the U8g2 library seems to need to much memory for the Sparkfun Pro Micro board (5V version) that I am using. The compiler stops with the message that I would need 109 % of the memory present (31470 bytes needed, 28672 bytes present). I generated the code with the TcMenu UI designer and used most of the example sketch "simpleU8g2".
My question: Is there an easy way to reduce memory needed? As I have a fairly easy menu in mind (just 1 layer with 4-6 selectable choices), is there an alternative that would need less space, maybe 8x8 library or some other way to create a menu?
Thanks,
Tom
#include "TestforTcMenu_menu.h"
#include <IoAbstraction.h>
// the width and height of the attached OLED display.
#define OLED_WIDTH 128
#define OLED_HEIGHT 64
// Here we declare the variable using exactly the name that we used in the
// designers code generator panel for the graphics variable. The name and
// type must match exactly
U8G2_SH1106_128X64_NONAME_F_HW_I2C gfx(U8G2_R0, 5, 4);
IoAbstractionRef arduinoPins = ioUsingArduino();
//
// In a tcMenu application, before calling setupMenu it's your responsibility to ensure
// that the display you're going to use is ready for drawing. You also need to start
// wire if you have any I2C devices. Here I start serial for some printing in the callback.
//
void setup() {
// If you use i2c devices, be sure to start wire.
Serial.begin(115200);
// start up the display. Important, the rendering expects this has been done.
gfx.begin();
// This is added by tcMenu Designer automatically during the first setup.
setupMenu();
// Note:
// during setup in a full menu application you'd probably load values
// back from EEPROM and maybe initialise your remote code (see other examples)
}
//
// In any IoAbstraction based application you'll normally use tasks via taskManager
// instead of writing code in loop. You are free to write code here as long as it
// does not delay or block execution. Otherwise task manager will be blocked.
//
void loop() {
taskManager.runLoop();
}
//
// this is the callback function that we declared in the designer for action
// "Start Toasting". This will be called when the action is performed. Notice
// instead of using callbacks for every toaster setting, we just get the value
// associated with the menu item directly.
//
void CALLBACK_FUNCTION onStartToasting(int id) {
Serial.println("Let's start toasting");
Serial.print("Power: "); Serial.println(menuToasterPower.getCurrentValue());
Serial.print("Type: "); Serial.println(menuType.getCurrentValue());
Serial.print("Frozen: "); Serial.println(menuFrozen.getCurrentValue());
}