MCPcopy Create free account
hub / github.com/BruceDevices/firmware / getOptionsJSON

Function getOptionsJSON

src/core/utils.cpp:230–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228#endif
229
230String getOptionsJSON() {
231 String menutype = "regular_menu";
232 if (menuOptionType == 0) menutype = "main_menu";
233 else if (menuOptionType == 1) menutype = "sub_menu";
234
235 String response = "{\"width\":" + String(tftWidth) + ", \"height\":" + String(tftHeight) +
236 ",\"menu\":\"" + menutype + "\",\"menu_title\":\"" + menuOptionLabel +
237 "\", \"options\":[";
238 int i = 0;
239 int sel = 0;
240 for (auto opt : options) {
241 response += "{\"n\":" + String(i) + ",\"label\":\"" + opt.label + "\"}";
242 if (opt.hovered) sel = i;
243 i++;
244 if (i < options.size()) response += ",";
245 }
246 response += "], \"active\":" + String(sel) + "}";
247 return response;
248}
249
250/*********************************************************************
251** Function: i2c_bulk_write

Callers 1

optionsJsonCallbackFunction · 0.85

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected