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

Method leftButton

src/MenuManager.cpp:275–334  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273}
274
275void MenuManager_::leftButton()
276{
277 if (!inMenu)
278 {
279 return;
280 }
281 switch (currentState)
282 {
283 case MainMenu:
284 menuIndex = (menuIndex == 0) ? menuItemCount - 1 : menuIndex - 1;
285 break;
286 case BrightnessMenu:
287 if (!AUTO_BRIGHTNESS)
288 {
289 BRIGHTNESS_PERCENT = (BRIGHTNESS_PERCENT == 1) ? 100 : BRIGHTNESS_PERCENT - 1;
290 BRIGHTNESS = convertBRIPercentTo8Bit(BRIGHTNESS_PERCENT);
291 DisplayManager.setBrightness(BRIGHTNESS);
292 }
293 break;
294 case ColorMenu:
295 currentColor = (currentColor + sizeof(textColors) / sizeof(textColors[0]) - 1) % (sizeof(textColors) / sizeof(textColors[0]));
296 break;
297 case SwitchMenu:
298 AUTO_TRANSITION = !AUTO_TRANSITION;
299 break;
300 case TspeedMenu:
301 TIME_PER_TRANSITION = max(200, TIME_PER_TRANSITION - 100);
302 break;
303 case AppTimeMenu:
304 TIME_PER_APP = max(static_cast<long>(1000), TIME_PER_APP - 1000);
305 break;
306 case TimeFormatMenu:
307 timeFormatIndex = (timeFormatIndex == 0) ? timeFormatCount - 1 : timeFormatIndex - 1;
308 break;
309 case DateFormatMenu:
310 dateFormatIndex = (dateFormatIndex == 0) ? dateFormatCount - 1 : dateFormatIndex - 1;
311 break;
312 case Appmenu:
313 appsIndex = (appsIndex == 0) ? appsCount - 1 : appsIndex - 1;
314 break;
315 case WeekdayMenu:
316 START_ON_MONDAY = !START_ON_MONDAY;
317 break;
318 case TempMenu:
319 IS_CELSIUS = !IS_CELSIUS;
320 break;
321 case SoundMenu:
322 SOUND_ACTIVE = !SOUND_ACTIVE;
323 break;
324 case VolumeMenu:
325 if (!(DFPLAYER_ACTIVE || BUZ_VOL))
326 break;
327 if ((SOUND_VOLUME - 1) < 0)
328 SOUND_VOLUME = 30;
329 else
330 SOUND_VOLUME--;
331 default:
332 break;

Callers 1

left_button_pressedFunction · 0.45

Calls 2

convertBRIPercentTo8BitFunction · 0.85
setBrightnessMethod · 0.45

Tested by

no test coverage detected