MCPcopy Create free account
hub / github.com/Blueforcer/awtrix3 / selectButton

Method selectButton

src/MenuManager.cpp:336–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

334}
335
336void MenuManager_::selectButton()
337{
338 if (!inMenu)
339 {
340 return;
341 }
342 switch (currentState)
343 {
344 case MainMenu:
345 currentState = (MenuState)(menuIndex + 1);
346 switch (currentState)
347 {
348 case BrightnessMenu:
349 // reverse of convertBRIPercentTo8Bit.
350 if (BRIGHTNESS <= 10)
351 {
352 BRIGHTNESS_PERCENT = BRIGHTNESS;
353 }
354 else
355 {
356 BRIGHTNESS_PERCENT = map(BRIGHTNESS, 0, 255, 0, 100);
357 }
358 break;
359 case UpdateMenu:
360 if (UpdateManager.checkUpdate(true))
361 {
362 UpdateManager.updateFirmware();
363 }
364 break;
365 }
366 break;
367 case BrightnessMenu:
368 AUTO_BRIGHTNESS = !AUTO_BRIGHTNESS;
369 if (!AUTO_BRIGHTNESS)
370 {
371 BRIGHTNESS = convertBRIPercentTo8Bit(BRIGHTNESS_PERCENT);
372 DisplayManager.setBrightness(BRIGHTNESS);
373 }
374 break;
375 case Appmenu:
376 switch (appsIndex)
377 {
378 case 0:
379 SHOW_TIME = !SHOW_TIME;
380 break;
381 case 1:
382 SHOW_DATE = !SHOW_DATE;
383 break;
384 case 2:
385 SHOW_TEMP = !SHOW_TEMP;
386 break;
387 case 3:
388 SHOW_HUM = !SHOW_HUM;
389 break;
390#ifndef awtrix2_upgrade
391 case 4:
392 SHOW_BAT = !SHOW_BAT;
393 break;

Callers 1

select_button_pressedFunction · 0.45

Calls 4

convertBRIPercentTo8BitFunction · 0.85
checkUpdateMethod · 0.80
updateFirmwareMethod · 0.80
setBrightnessMethod · 0.45

Tested by

no test coverage detected