-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some helpful info for contributors
- Loading branch information
MrARM
committed
Feb 23, 2020
1 parent
fb9a991
commit 3998b6e
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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**. |