Skip to content

Latest commit

 

History

History
48 lines (30 loc) · 1.39 KB

CONTRIBUTING.md

File metadata and controls

48 lines (30 loc) · 1.39 KB

Adding functions

To add new functions to HACKRWATCH, follow these steps

  1. Assign a sequential number to the switcher, comment this on the switcher comment around line 41

  2. Add 2 methods, a loop and a setup. This follows the same execution style of how Arduino does setup() and loop(). Use comments to seperate the methods(Eventually this should be seperated into files)

  3. Add your methods to the case statements at the bottom of the code

Add to a menu

For this example we will add a new app to the main menu

Locate the main menu comment, and find the mmenu[]

Add your entry to the array, along with the switch code you added to the switcher.

Lock the switcher to utilize the side button

Set rstOverride to true.

Make sure to set this to false while switching!

Switch to another app

Paste the following code to switch

isSwitching = true;
current_proc = <SWITCHER NUMBER>;

On the next loop, the setup method for the other app will be called.

Important code when switching

When you want to switch, generally you should clear the LCD and set the rotation to the direction your app needs

For example, this is the clock setup:

void clock_setup() {
  M5.Lcd.setRotation(rotation);
  M5.Lcd.fillScreen(BLACK);
  M5.Lcd.setTextSize(1);
}

Note the setRoation call, rotation is going to be your landscape rotation set in the EEPROM. If you want to use portrait, use 0.