| 228 | #endif |
| 229 | |
| 230 | String 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 |
no test coverage detected