Skip to content

Commit

Permalink
Add some helpful info for contributors
Browse files Browse the repository at this point in the history
  • Loading branch information
MrARM committed Feb 23, 2020
1 parent fb9a991 commit 3998b6e
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 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.

# 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**.

0 comments on commit 3998b6e

Please sign in to comment.