Adding support for M5StickC (same hardware, smaller display)
This commit is contained in:
parent
ab3d3128b2
commit
be1b0f17b1
|
@ -1,6 +1,18 @@
|
|||
// Nemo Firmware for the M5 Stack Stick C Plus
|
||||
// github.com/n0xa | IG: @4x0nn
|
||||
#define PLUS
|
||||
#if defined(PLUS)
|
||||
#include <M5StickCPlus.h>
|
||||
#define BIG_TEXT 4
|
||||
#define MEDIUM_TEXT 3
|
||||
#define SMALL_TEXT 2
|
||||
#else
|
||||
#include <M5StickC.h>
|
||||
#define BIG_TEXT 2
|
||||
#define MEDIUM_TEXT 2
|
||||
#define SMALL_TEXT 1
|
||||
#endif
|
||||
|
||||
#include <EEPROM.h>
|
||||
#include <IRremoteESP8266.h>
|
||||
#include <IRsend.h>
|
||||
|
@ -97,7 +109,7 @@ MENU mmenu[] = {
|
|||
};
|
||||
|
||||
void mmenu_drawmenu() {
|
||||
M5.Lcd.setTextSize(2);
|
||||
M5.Lcd.setTextSize(SMALL_TEXT);
|
||||
M5.Lcd.fillScreen(BLACK);
|
||||
M5.Lcd.setCursor(0, 8, 1);
|
||||
for ( int i = 0 ; i < ( sizeof(mmenu) / sizeof(MENU) ) ; i++ ) {
|
||||
|
@ -139,7 +151,7 @@ MENU smenu[] = {
|
|||
};
|
||||
|
||||
void smenu_drawmenu() {
|
||||
M5.Lcd.setTextSize(2);
|
||||
M5.Lcd.setTextSize(SMALL_TEXT);
|
||||
M5.Lcd.fillScreen(BLACK);
|
||||
M5.Lcd.setCursor(0, 8, 1);
|
||||
for ( int i = 0 ; i < ( sizeof(smenu) / sizeof(MENU) ) ; i++ ) {
|
||||
|
@ -182,7 +194,7 @@ MENU dmenu[] = {
|
|||
};
|
||||
|
||||
void dmenu_drawmenu() {
|
||||
M5.Lcd.setTextSize(2);
|
||||
M5.Lcd.setTextSize(SMALL_TEXT);
|
||||
M5.Lcd.fillScreen(BLACK);
|
||||
M5.Lcd.setCursor(0, 8, 1);
|
||||
for ( int i = 0 ; i < ( sizeof(dmenu) / sizeof(MENU) ) ; i++ ) {
|
||||
|
@ -259,7 +271,7 @@ MENU rmenu[] = {
|
|||
};
|
||||
|
||||
void rmenu_drawmenu() {
|
||||
M5.Lcd.setTextSize(2);
|
||||
M5.Lcd.setTextSize(SMALL_TEXT);
|
||||
M5.Lcd.fillScreen(BLACK);
|
||||
M5.Lcd.setCursor(0, 8, 1);
|
||||
for ( int i = 0 ; i < ( sizeof(rmenu) / sizeof(MENU) ) ; i++ ) {
|
||||
|
@ -295,7 +307,7 @@ void rmenu_loop() {
|
|||
|
||||
/// BATTERY INFO ///
|
||||
void battery_drawmenu(int battery, int b, int c) {
|
||||
M5.Lcd.setTextSize(2);
|
||||
M5.Lcd.setTextSize(SMALL_TEXT);
|
||||
M5.Lcd.fillScreen(BLACK);
|
||||
M5.Lcd.setCursor(0, 8, 1);
|
||||
M5.Lcd.print("Battery: ");
|
||||
|
@ -334,10 +346,10 @@ void battery_loop() {
|
|||
/// TV-B-GONE ///
|
||||
void tvbgone_setup() {
|
||||
M5.Lcd.fillScreen(BLACK);
|
||||
M5.Lcd.setTextSize(4);
|
||||
M5.Lcd.setTextSize(BIG_TEXT);
|
||||
M5.Lcd.setCursor(5, 1);
|
||||
M5.Lcd.println("TV-B-Gone");
|
||||
M5.Lcd.setTextSize(2);
|
||||
M5.Lcd.setTextSize(SMALL_TEXT);
|
||||
irsend.begin();
|
||||
// Hack: Set IRLED high to turn it off after setup. Otherwise it stays on (active low)
|
||||
digitalWrite(IRLED, HIGH);
|
||||
|
@ -375,7 +387,7 @@ MENU tvbgmenu[] = {
|
|||
};
|
||||
|
||||
void tvbgmenu_drawmenu() {
|
||||
M5.Lcd.setTextSize(2);
|
||||
M5.Lcd.setTextSize(SMALL_TEXT);
|
||||
M5.Lcd.fillScreen(BLACK);
|
||||
M5.Lcd.setCursor(0, 8, 1);
|
||||
for ( int i = 0 ; i < ( sizeof(tvbgmenu) / sizeof(MENU) ) ; i++ ) {
|
||||
|
@ -386,10 +398,10 @@ void tvbgmenu_drawmenu() {
|
|||
|
||||
void tvbgmenu_setup() {
|
||||
M5.Lcd.fillScreen(BLACK);
|
||||
M5.Lcd.setTextSize(4);
|
||||
M5.Lcd.setTextSize(BIG_TEXT);
|
||||
M5.Lcd.setCursor(5, 1);
|
||||
M5.Lcd.println("TV-B-Gone");
|
||||
M5.Lcd.setTextSize(3);
|
||||
M5.Lcd.setTextSize(MEDIUM_TEXT);
|
||||
M5.Lcd.println("Region");
|
||||
cursor = region % 2;
|
||||
rstOverride = true;
|
||||
|
@ -419,7 +431,7 @@ void tvbgmenu_loop() {
|
|||
void clock_setup() {
|
||||
M5.Lcd.setRotation(rotation);
|
||||
M5.Lcd.fillScreen(BLACK);
|
||||
M5.Lcd.setTextSize(3);
|
||||
M5.Lcd.setTextSize(MEDIUM_TEXT);
|
||||
}
|
||||
|
||||
void clock_loop() {
|
||||
|
@ -432,7 +444,7 @@ void clock_loop() {
|
|||
/// TIMESET ///
|
||||
void timeset_drawmenu(int nums) {
|
||||
M5.Lcd.setRotation(rotation);
|
||||
M5.Lcd.setTextSize(2);
|
||||
M5.Lcd.setTextSize(SMALL_TEXT);
|
||||
M5.Lcd.fillScreen(BLACK);
|
||||
M5.Lcd.setCursor(0, 5, 1);
|
||||
// scrolling menu
|
||||
|
@ -536,7 +548,7 @@ MENU ajmenu[] = {
|
|||
|
||||
void aj_drawmenu() {
|
||||
M5.Lcd.setRotation(rotation);
|
||||
M5.Lcd.setTextSize(2);
|
||||
M5.Lcd.setTextSize(SMALL_TEXT);
|
||||
M5.Lcd.fillScreen(BLACK);
|
||||
M5.Lcd.setCursor(0, 5, 1);
|
||||
// scrolling menu
|
||||
|
@ -556,7 +568,7 @@ void aj_drawmenu() {
|
|||
|
||||
void aj_setup(){
|
||||
M5.Lcd.fillScreen(BLACK);
|
||||
M5.Lcd.setTextSize(3);
|
||||
M5.Lcd.setTextSize(MEDIUM_TEXT);
|
||||
M5.Lcd.setCursor(5, 1);
|
||||
M5.Lcd.println("AppleJuice");
|
||||
delay(1000);
|
||||
|
@ -670,10 +682,10 @@ void aj_loop(){
|
|||
if (current_proc == 8 && isSwitching == false){
|
||||
M5.Lcd.setRotation(rotation);
|
||||
M5.Lcd.fillScreen(BLACK);
|
||||
M5.Lcd.setTextSize(3);
|
||||
M5.Lcd.setTextSize(MEDIUM_TEXT);
|
||||
M5.Lcd.setCursor(5, 1);
|
||||
M5.Lcd.println("AppleJuice");
|
||||
M5.Lcd.setTextSize(2);
|
||||
M5.Lcd.setTextSize(SMALL_TEXT);
|
||||
M5.Lcd.print("Advertising:\n");
|
||||
M5.Lcd.print(ajmenu[cursor].name);
|
||||
M5.Lcd.print("\n\nSide Key: Exit");
|
||||
|
@ -725,10 +737,10 @@ void credits_setup(){
|
|||
M5.Lcd.fillScreen(WHITE);
|
||||
M5.Lcd.qrcode("https://github.com/n0xa/m5stick-nemo", 145, 40, 100, 5);
|
||||
M5.Lcd.setTextColor(BLACK, WHITE);
|
||||
M5.Lcd.setTextSize(3);
|
||||
M5.Lcd.setTextSize(MEDIUM_TEXT);
|
||||
M5.Lcd.setCursor(0, 25);
|
||||
M5.Lcd.print(" M5-NEMO\n");
|
||||
M5.Lcd.setTextSize(2);
|
||||
M5.Lcd.setTextSize(SMALL_TEXT);
|
||||
M5.Lcd.println(" For M5Stack");
|
||||
M5.Lcd.println(" StickC-Plus");
|
||||
M5.Lcd.println("By Noah Axon");
|
||||
|
@ -766,7 +778,7 @@ void wifispam_setup() {
|
|||
esp_wifi_set_channel(channels[0], WIFI_SECOND_CHAN_NONE);
|
||||
|
||||
M5.Lcd.fillScreen(BLACK);
|
||||
M5.Lcd.setTextSize(4);
|
||||
M5.Lcd.setTextSize(BIG_TEXT);
|
||||
M5.Lcd.setCursor(5, 1);
|
||||
M5.Lcd.println("WiFi Spam");
|
||||
delay(1000);
|
||||
|
@ -791,7 +803,7 @@ void wifispam_setup() {
|
|||
// placed here for consistency. no-op since display handled in loop.
|
||||
break;
|
||||
}
|
||||
M5.Lcd.setTextSize(2);
|
||||
M5.Lcd.setTextSize(SMALL_TEXT);
|
||||
current_proc = 11;
|
||||
}
|
||||
|
||||
|
@ -840,7 +852,7 @@ MENU wsmenu[] = {
|
|||
};
|
||||
|
||||
void wsmenu_drawmenu() {
|
||||
M5.Lcd.setTextSize(2);
|
||||
M5.Lcd.setTextSize(SMALL_TEXT);
|
||||
M5.Lcd.fillScreen(BLACK);
|
||||
M5.Lcd.setCursor(0, 8, 1);
|
||||
for ( int i = 0 ; i < ( sizeof(wsmenu) / sizeof(MENU) ) ; i++ ) {
|
||||
|
@ -929,7 +941,7 @@ void setup() {
|
|||
// Boot Screen
|
||||
digitalWrite(M5_LED, HIGH); //LEDOFF
|
||||
M5.Lcd.fillScreen(BLACK);
|
||||
M5.Lcd.setTextSize(4);
|
||||
M5.Lcd.setTextSize(BIG_TEXT);
|
||||
M5.Lcd.setCursor(40, 15);
|
||||
M5.Lcd.print("M5-NEMO\n");
|
||||
// Pin setup
|
||||
|
|
8
tvbg.h
8
tvbg.h
|
@ -102,10 +102,10 @@ void sendAllCodes()
|
|||
const uint8_t freq = powerCode->timer_val;
|
||||
const uint8_t numpairs = powerCode->numpairs;
|
||||
M5.Lcd.fillScreen(BLACK);
|
||||
M5.Lcd.setTextSize(4);
|
||||
M5.Lcd.setTextSize(BIG_TEXT);
|
||||
M5.Lcd.setCursor(5, 1);
|
||||
M5.Lcd.println("TV-B-Gone");
|
||||
M5.Lcd.setTextSize(2);
|
||||
M5.Lcd.setTextSize(SMALL_TEXT);
|
||||
M5.Lcd.println("Front Key: Go/Pause");
|
||||
const uint8_t bitcompression = powerCode->bitcompression;
|
||||
code_ptr = 0;
|
||||
|
@ -146,10 +146,10 @@ void sendAllCodes()
|
|||
quickflashLEDx(8);
|
||||
}
|
||||
M5.Lcd.fillScreen(BLACK);
|
||||
M5.Lcd.setTextSize(4);
|
||||
M5.Lcd.setTextSize(BIG_TEXT);
|
||||
M5.Lcd.setCursor(5, 1);
|
||||
M5.Lcd.println("TV-B-Gone");
|
||||
M5.Lcd.setTextSize(2);
|
||||
M5.Lcd.setTextSize(SMALL_TEXT);
|
||||
M5.Lcd.println("Front Key: Go/Pause");
|
||||
M5.Lcd.println("Side Key: Exit");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue