commit
21eb55ca28
|
@ -0,0 +1,37 @@
|
||||||
|
#include <BLEDevice.h>
|
||||||
|
// globals for passing bluetooth info between routines
|
||||||
|
// AppleJuice Payload Data
|
||||||
|
uint8_t Airpods[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x02, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||||
|
uint8_t AirpodsPro[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x0e, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||||
|
uint8_t AirpodsMax[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x0a, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||||
|
uint8_t AirpodsGen2[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x0f, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||||
|
uint8_t AirpodsGen3[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x13, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||||
|
uint8_t AirpodsProGen2[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x14, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||||
|
uint8_t PowerBeats[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x03, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||||
|
uint8_t PowerBeatsPro[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x0b, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||||
|
uint8_t BeatsSoloPro[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x0c, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||||
|
uint8_t BeatsStudioBuds[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x11, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||||
|
uint8_t BeatsFlex[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x10, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||||
|
uint8_t BeatsX[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x05, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||||
|
uint8_t BeatsSolo3[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x06, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||||
|
uint8_t BeatsStudio3[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x09, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||||
|
uint8_t BeatsStudioPro[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x17, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||||
|
uint8_t BeatsFitPro[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x12, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||||
|
uint8_t BeatsStudioBudsPlus[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x16, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||||
|
uint8_t AppleTVSetup[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x01, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00};
|
||||||
|
uint8_t AppleTVPair[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x06, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00};
|
||||||
|
uint8_t AppleTVNewUser[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x20, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00};
|
||||||
|
uint8_t AppleTVAppleIDSetup[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x2b, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00};
|
||||||
|
uint8_t AppleTVWirelessAudioSync[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0xc0, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00};
|
||||||
|
uint8_t AppleTVHomekitSetup[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x0d, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00};
|
||||||
|
uint8_t AppleTVKeyboard[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x13, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00};
|
||||||
|
uint8_t AppleTVConnectingToNetwork[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x27, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00};
|
||||||
|
uint8_t HomepodSetup[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x0b, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00};
|
||||||
|
uint8_t SetupNewPhone[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x09, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00};
|
||||||
|
uint8_t TransferNumber[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x02, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00};
|
||||||
|
uint8_t TVColorBalance[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x1e, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00};
|
||||||
|
uint8_t* data;
|
||||||
|
int deviceType = 0;
|
||||||
|
|
||||||
|
BLEAdvertisementData oAdvertisementData = BLEAdvertisementData();
|
||||||
|
BLEAdvertising *pAdvertising;
|
269
m5stick-nemo.ino
269
m5stick-nemo.ino
|
@ -4,6 +4,7 @@
|
||||||
#include <EEPROM.h>
|
#include <EEPROM.h>
|
||||||
#include <IRremoteESP8266.h>
|
#include <IRremoteESP8266.h>
|
||||||
#include <IRsend.h>
|
#include <IRsend.h>
|
||||||
|
#include "applejuice.h"
|
||||||
#include "WORLD_IR_CODES.h"
|
#include "WORLD_IR_CODES.h"
|
||||||
#include <BLEDevice.h>
|
#include <BLEDevice.h>
|
||||||
#include <BLEUtils.h>
|
#include <BLEUtils.h>
|
||||||
|
@ -12,53 +13,15 @@ int advtime = 0;
|
||||||
String formattedDate;
|
String formattedDate;
|
||||||
String dayStamp;
|
String dayStamp;
|
||||||
String timeStamp;
|
String timeStamp;
|
||||||
|
int cursor = 0;
|
||||||
// globals for passing bluetooth info between routines
|
int rotation = 1;
|
||||||
// AppleJuice Payload Data
|
bool rstOverride = false;
|
||||||
uint8_t Airpods[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x02, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
|
||||||
uint8_t AirpodsPro[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x0e, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
|
||||||
uint8_t AirpodsMax[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x0a, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
|
||||||
uint8_t AirpodsGen2[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x0f, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
|
||||||
uint8_t AirpodsGen3[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x13, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
|
||||||
uint8_t AirpodsProGen2[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x14, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
|
||||||
uint8_t PowerBeats[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x03, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
|
||||||
uint8_t PowerBeatsPro[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x0b, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
|
||||||
uint8_t BeatsSoloPro[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x0c, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
|
||||||
uint8_t BeatsStudioBuds[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x11, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
|
||||||
uint8_t BeatsFlex[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x10, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
|
||||||
uint8_t BeatsX[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x05, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
|
||||||
uint8_t BeatsSolo3[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x06, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
|
||||||
uint8_t BeatsStudio3[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x09, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
|
||||||
uint8_t BeatsStudioPro[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x17, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
|
||||||
uint8_t BeatsFitPro[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x12, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
|
||||||
uint8_t BeatsStudioBudsPlus[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x16, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
|
||||||
uint8_t AppleTVSetup[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x01, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00};
|
|
||||||
uint8_t AppleTVPair[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x06, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00};
|
|
||||||
uint8_t AppleTVNewUser[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x20, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00};
|
|
||||||
uint8_t AppleTVAppleIDSetup[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x2b, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00};
|
|
||||||
uint8_t AppleTVWirelessAudioSync[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0xc0, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00};
|
|
||||||
uint8_t AppleTVHomekitSetup[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x0d, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00};
|
|
||||||
uint8_t AppleTVKeyboard[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x13, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00};
|
|
||||||
uint8_t AppleTVConnectingToNetwork[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x27, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00};
|
|
||||||
uint8_t HomepodSetup[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x0b, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00};
|
|
||||||
uint8_t SetupNewPhone[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x09, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00};
|
|
||||||
uint8_t TransferNumber[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x02, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00};
|
|
||||||
uint8_t TVColorBalance[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x1e, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00};
|
|
||||||
uint8_t* data;
|
|
||||||
int deviceType = 0;
|
|
||||||
|
|
||||||
BLEAdvertisementData oAdvertisementData = BLEAdvertisementData();
|
|
||||||
BLEAdvertising *pAdvertising;
|
|
||||||
|
|
||||||
#define EEPROM_SIZE 1
|
#define EEPROM_SIZE 1
|
||||||
|
|
||||||
struct MENU {
|
struct MENU {
|
||||||
char name[19];
|
char name[19];
|
||||||
int command;
|
int command;
|
||||||
};
|
};
|
||||||
int cursor = 0;
|
|
||||||
int rotation = 1;
|
|
||||||
bool rstOverride = false;
|
|
||||||
|
|
||||||
/// SWITCHER ///
|
/// SWITCHER ///
|
||||||
// Proc codes
|
// Proc codes
|
||||||
|
@ -72,6 +35,7 @@ bool rstOverride = false;
|
||||||
// 7 - screen rotation
|
// 7 - screen rotation
|
||||||
// 8 - AppleJuice Menu
|
// 8 - AppleJuice Menu
|
||||||
// 9 - AppleJuice Advertisement
|
// 9 - AppleJuice Advertisement
|
||||||
|
// 10 - Credits
|
||||||
|
|
||||||
bool isSwitching = true;
|
bool isSwitching = true;
|
||||||
int current_proc = 0; // Start in Clock Mode
|
int current_proc = 0; // Start in Clock Mode
|
||||||
|
@ -280,6 +244,7 @@ void rmenu_loop() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// BATTERY INFO ///
|
||||||
void battery_drawmenu(int battery, int b, int c) {
|
void battery_drawmenu(int battery, int b, int c) {
|
||||||
M5.Lcd.setTextSize(2);
|
M5.Lcd.setTextSize(2);
|
||||||
M5.Lcd.fillScreen(BLACK);
|
M5.Lcd.fillScreen(BLACK);
|
||||||
|
@ -318,41 +283,6 @@ void battery_loop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// TV-B-GONE ///
|
/// TV-B-GONE ///
|
||||||
void xmitCodeElement(uint16_t ontime, uint16_t offtime, uint8_t PWM_code );
|
|
||||||
void quickflashLEDx( uint8_t x );
|
|
||||||
void delay_ten_us(uint16_t us);
|
|
||||||
void quickflashLED( void );
|
|
||||||
uint8_t read_bits(uint8_t count);
|
|
||||||
uint16_t rawData[300];
|
|
||||||
#define MAX_WAIT_TIME 65535 //tens of us (ie: 655.350ms)
|
|
||||||
IRsend irsend(IRLED); // Set the GPIO to be used to sending the message.
|
|
||||||
extern const IrCode* const NApowerCodes[];
|
|
||||||
extern const IrCode* const EUpowerCodes[];
|
|
||||||
extern uint8_t num_NAcodes, num_EUcodes;
|
|
||||||
uint8_t bitsleft_r = 0;
|
|
||||||
uint8_t bits_r = 0;
|
|
||||||
uint8_t code_ptr;
|
|
||||||
volatile const IrCode * powerCode;
|
|
||||||
uint8_t read_bits(uint8_t count)
|
|
||||||
{
|
|
||||||
uint8_t i;
|
|
||||||
uint8_t tmp = 0;
|
|
||||||
for (i = 0; i < count; i++) {
|
|
||||||
if (bitsleft_r == 0) {
|
|
||||||
bits_r = powerCode->codes[code_ptr++];
|
|
||||||
bitsleft_r = 8;
|
|
||||||
}
|
|
||||||
bitsleft_r--;
|
|
||||||
tmp |= (((bits_r >> (bitsleft_r)) & 1) << (count - 1 - i));
|
|
||||||
}
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
#define BUTTON_PRESSED LOW
|
|
||||||
#define BUTTON_RELEASED HIGH
|
|
||||||
uint16_t ontime, offtime;
|
|
||||||
uint8_t i, num_codes;
|
|
||||||
uint8_t region;
|
|
||||||
|
|
||||||
void tvbgone_setup() {
|
void tvbgone_setup() {
|
||||||
M5.Lcd.fillScreen(BLACK);
|
M5.Lcd.fillScreen(BLACK);
|
||||||
M5.Lcd.setTextSize(4);
|
M5.Lcd.setTextSize(4);
|
||||||
|
@ -374,72 +304,6 @@ void tvbgone_setup() {
|
||||||
delay(1000); // Give time after loading
|
delay(1000); // Give time after loading
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendAllCodes()
|
|
||||||
{
|
|
||||||
bool endingEarly = false; //will be set to true if the user presses the button during code-sending
|
|
||||||
if (digitalRead(REGIONSWITCH)) {
|
|
||||||
region = NA;
|
|
||||||
num_codes = num_NAcodes;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
region = EU;
|
|
||||||
num_codes = num_EUcodes;
|
|
||||||
}
|
|
||||||
for (i = 0 ; i < num_codes; i++)
|
|
||||||
{
|
|
||||||
if (region == NA) {
|
|
||||||
powerCode = NApowerCodes[i];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
powerCode = EUpowerCodes[i];
|
|
||||||
}
|
|
||||||
const uint8_t freq = powerCode->timer_val;
|
|
||||||
const uint8_t numpairs = powerCode->numpairs;
|
|
||||||
M5.Lcd.fillScreen(BLACK);
|
|
||||||
M5.Lcd.setTextSize(4);
|
|
||||||
M5.Lcd.setCursor(5, 1);
|
|
||||||
M5.Lcd.println("TV-B-Gone");
|
|
||||||
M5.Lcd.setTextSize(2);
|
|
||||||
const uint8_t bitcompression = powerCode->bitcompression;
|
|
||||||
code_ptr = 0;
|
|
||||||
for (uint8_t k = 0; k < numpairs; k++) {
|
|
||||||
uint16_t ti;
|
|
||||||
ti = (read_bits(bitcompression)) * 2;
|
|
||||||
offtime = powerCode->times[ti]; // read word 1 - ontime
|
|
||||||
ontime = powerCode->times[ti + 1]; // read word 2 - offtime
|
|
||||||
M5.Lcd.setTextSize(1);
|
|
||||||
M5.Lcd.printf("rti = %d Pair = %d, %d\n", ti >> 1, ontime, offtime);
|
|
||||||
rawData[k * 2] = offtime * 10;
|
|
||||||
rawData[(k * 2) + 1] = ontime * 10;
|
|
||||||
yield();
|
|
||||||
}
|
|
||||||
irsend.sendRaw(rawData, (numpairs * 2) , freq);
|
|
||||||
// Hack: Set IRLED high to turn it off after each burst. Otherwise it stays on (active low)
|
|
||||||
digitalWrite(IRLED, HIGH);
|
|
||||||
yield();
|
|
||||||
bitsleft_r = 0;
|
|
||||||
delay_ten_us(20500);
|
|
||||||
if (digitalRead(TRIGGER) == BUTTON_PRESSED)
|
|
||||||
{
|
|
||||||
while (digitalRead(TRIGGER) == BUTTON_PRESSED) {
|
|
||||||
yield();
|
|
||||||
}
|
|
||||||
endingEarly = true;
|
|
||||||
delay_ten_us(50000); //500ms delay
|
|
||||||
quickflashLEDx(4);
|
|
||||||
delay_ten_us(MAX_WAIT_TIME); // wait 655.350ms
|
|
||||||
delay_ten_us(MAX_WAIT_TIME); // wait 655.350ms
|
|
||||||
break; //exit the POWER code "for" loop
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (endingEarly == false)
|
|
||||||
{
|
|
||||||
delay_ten_us(MAX_WAIT_TIME); // wait 655.350ms
|
|
||||||
delay_ten_us(MAX_WAIT_TIME); // wait 655.350ms
|
|
||||||
quickflashLEDx(8);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void tvbgone_loop()
|
void tvbgone_loop()
|
||||||
{
|
{
|
||||||
if (digitalRead(TRIGGER) == BUTTON_PRESSED)
|
if (digitalRead(TRIGGER) == BUTTON_PRESSED)
|
||||||
|
@ -454,32 +318,6 @@ void tvbgone_loop()
|
||||||
yield();
|
yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
void delay_ten_us(uint16_t us) {
|
|
||||||
uint8_t timer;
|
|
||||||
while (us != 0) {
|
|
||||||
for (timer = 0; timer <= DELAY_CNT; timer++) {
|
|
||||||
NOP;
|
|
||||||
NOP;
|
|
||||||
}
|
|
||||||
NOP;
|
|
||||||
us--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void quickflashLED( void ) {
|
|
||||||
digitalWrite(LED, LOW);
|
|
||||||
delay_ten_us(3000); // 30 ms ON-time delay
|
|
||||||
digitalWrite(LED, HIGH);
|
|
||||||
}
|
|
||||||
|
|
||||||
void quickflashLEDx( uint8_t x ) {
|
|
||||||
quickflashLED();
|
|
||||||
while (--x) {
|
|
||||||
delay_ten_us(25000); // 250 ms OFF-time delay between flashes
|
|
||||||
quickflashLED();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// CLOCK ///
|
/// CLOCK ///
|
||||||
void clock_setup() {
|
void clock_setup() {
|
||||||
M5.Lcd.setRotation(rotation);
|
M5.Lcd.setRotation(rotation);
|
||||||
|
@ -515,6 +353,7 @@ void timeset_drawmenu(int nums) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// TIME SETTING ///
|
||||||
void timeset_setup() {
|
void timeset_setup() {
|
||||||
rstOverride = true;
|
rstOverride = true;
|
||||||
M5.Lcd.fillScreen(BLACK);
|
M5.Lcd.fillScreen(BLACK);
|
||||||
|
@ -565,40 +404,7 @@ void timeset_loop() {
|
||||||
current_proc = 0;
|
current_proc = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ENTRY ///
|
/// AppleJuice ///
|
||||||
void setup() {
|
|
||||||
M5.begin();
|
|
||||||
M5.Axp.ScreenBreath(11); // Brightness
|
|
||||||
M5.Lcd.setRotation(rotation);
|
|
||||||
M5.Lcd.setTextColor(GREEN, BLACK);
|
|
||||||
EEPROM.begin(EEPROM_SIZE);
|
|
||||||
rotation = EEPROM.read(0);
|
|
||||||
|
|
||||||
// Boot Screen
|
|
||||||
digitalWrite(M5_LED, HIGH); //LEDOFF
|
|
||||||
M5.Lcd.fillScreen(BLACK);
|
|
||||||
M5.Lcd.setTextSize(4);
|
|
||||||
M5.Lcd.setCursor(40, 15);
|
|
||||||
M5.Lcd.setRotation(rotation);
|
|
||||||
M5.Lcd.print("M5-NEMO\n");
|
|
||||||
// Pin setup
|
|
||||||
pinMode(M5_LED, OUTPUT);
|
|
||||||
pinMode(M5_BUTTON_HOME, INPUT);
|
|
||||||
pinMode(M5_BUTTON_RST, INPUT);
|
|
||||||
|
|
||||||
// Random seed
|
|
||||||
randomSeed(analogRead(0));
|
|
||||||
|
|
||||||
// Create the BLE Server
|
|
||||||
BLEDevice::init("");
|
|
||||||
BLEServer *pServer = BLEDevice::createServer();
|
|
||||||
pAdvertising = pServer->getAdvertising();
|
|
||||||
BLEAdvertisementData oAdvertisementData = BLEAdvertisementData();
|
|
||||||
|
|
||||||
// Finish with time to show logo
|
|
||||||
delay(3000);
|
|
||||||
}
|
|
||||||
|
|
||||||
MENU ajmenu[] = {
|
MENU ajmenu[] = {
|
||||||
{ "AirPods", 1},
|
{ "AirPods", 1},
|
||||||
{ "AirPods Pro", 2},
|
{ "AirPods Pro", 2},
|
||||||
|
@ -814,21 +620,58 @@ void aj_adv(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// CREDITS ///
|
||||||
void credits_setup(){
|
void credits_setup(){
|
||||||
M5.Lcd.fillScreen(BLACK);
|
|
||||||
M5.Lcd.setTextSize(3);
|
|
||||||
M5.Lcd.setCursor(5, 10);
|
|
||||||
M5.Lcd.setRotation(rotation);
|
M5.Lcd.setRotation(rotation);
|
||||||
M5.Lcd.print("M5-NEMO\n");
|
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.setCursor(0, 25);
|
||||||
|
M5.Lcd.print(" M5-NEMO\n");
|
||||||
M5.Lcd.setTextSize(2);
|
M5.Lcd.setTextSize(2);
|
||||||
M5.Lcd.println("For M5StickC-Plus");
|
M5.Lcd.println(" For M5Stack");
|
||||||
|
M5.Lcd.println(" StickC-Plus");
|
||||||
M5.Lcd.println("By Noah Axon");
|
M5.Lcd.println("By Noah Axon");
|
||||||
M5.Lcd.println("| Instagram: @4x0nn");
|
M5.Lcd.setCursor(155, 5);
|
||||||
M5.Lcd.println("| GitHub: n0xa");
|
M5.Lcd.println("GitHub");
|
||||||
|
M5.Lcd.setCursor(155, 25);
|
||||||
|
M5.Lcd.println("Source:");
|
||||||
|
M5.Lcd.setTextColor(GREEN, BLACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void credits(){
|
/// ENTRY ///
|
||||||
delay(50);
|
void setup() {
|
||||||
|
M5.begin();
|
||||||
|
M5.Axp.ScreenBreath(11); // Brightness
|
||||||
|
M5.Lcd.setRotation(rotation);
|
||||||
|
M5.Lcd.setTextColor(GREEN, BLACK);
|
||||||
|
EEPROM.begin(EEPROM_SIZE);
|
||||||
|
rotation = EEPROM.read(0);
|
||||||
|
|
||||||
|
// Boot Screen
|
||||||
|
digitalWrite(M5_LED, HIGH); //LEDOFF
|
||||||
|
M5.Lcd.fillScreen(BLACK);
|
||||||
|
M5.Lcd.setTextSize(4);
|
||||||
|
M5.Lcd.setCursor(40, 15);
|
||||||
|
M5.Lcd.setRotation(rotation);
|
||||||
|
M5.Lcd.print("M5-NEMO\n");
|
||||||
|
// Pin setup
|
||||||
|
pinMode(M5_LED, OUTPUT);
|
||||||
|
pinMode(M5_BUTTON_HOME, INPUT);
|
||||||
|
pinMode(M5_BUTTON_RST, INPUT);
|
||||||
|
|
||||||
|
// Random seed
|
||||||
|
randomSeed(analogRead(0));
|
||||||
|
|
||||||
|
// Create the BLE Server
|
||||||
|
BLEDevice::init("");
|
||||||
|
BLEServer *pServer = BLEDevice::createServer();
|
||||||
|
pAdvertising = pServer->getAdvertising();
|
||||||
|
BLEAdvertisementData oAdvertisementData = BLEAdvertisementData();
|
||||||
|
|
||||||
|
// Finish with time to show logo
|
||||||
|
delay(3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
@ -909,7 +752,7 @@ void loop() {
|
||||||
aj_adv();
|
aj_adv();
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
credits();
|
// noop - just let the credits stay on screen
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
127
tvbg.h
127
tvbg.h
|
@ -47,3 +47,130 @@ struct IrCode {
|
||||||
uint16_t const *times;
|
uint16_t const *times;
|
||||||
uint8_t const *codes;
|
uint8_t const *codes;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void xmitCodeElement(uint16_t ontime, uint16_t offtime, uint8_t PWM_code );
|
||||||
|
void quickflashLEDx( uint8_t x );
|
||||||
|
void delay_ten_us(uint16_t us);
|
||||||
|
void quickflashLED( void );
|
||||||
|
uint8_t read_bits(uint8_t count);
|
||||||
|
uint16_t rawData[300];
|
||||||
|
#define MAX_WAIT_TIME 65535 //tens of us (ie: 655.350ms)
|
||||||
|
IRsend irsend(IRLED); // Set the GPIO to be used to sending the message.
|
||||||
|
extern const IrCode* const NApowerCodes[];
|
||||||
|
extern const IrCode* const EUpowerCodes[];
|
||||||
|
extern uint8_t num_NAcodes, num_EUcodes;
|
||||||
|
uint8_t bitsleft_r = 0;
|
||||||
|
uint8_t bits_r = 0;
|
||||||
|
uint8_t code_ptr;
|
||||||
|
volatile const IrCode * powerCode;
|
||||||
|
uint8_t read_bits(uint8_t count)
|
||||||
|
{
|
||||||
|
uint8_t i;
|
||||||
|
uint8_t tmp = 0;
|
||||||
|
for (i = 0; i < count; i++) {
|
||||||
|
if (bitsleft_r == 0) {
|
||||||
|
bits_r = powerCode->codes[code_ptr++];
|
||||||
|
bitsleft_r = 8;
|
||||||
|
}
|
||||||
|
bitsleft_r--;
|
||||||
|
tmp |= (((bits_r >> (bitsleft_r)) & 1) << (count - 1 - i));
|
||||||
|
}
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
#define BUTTON_PRESSED LOW
|
||||||
|
#define BUTTON_RELEASED HIGH
|
||||||
|
uint16_t ontime, offtime;
|
||||||
|
uint8_t i, num_codes;
|
||||||
|
uint8_t region;
|
||||||
|
|
||||||
|
void sendAllCodes()
|
||||||
|
{
|
||||||
|
bool endingEarly = false; //will be set to true if the user presses the button during code-sending
|
||||||
|
if (digitalRead(REGIONSWITCH)) {
|
||||||
|
region = NA;
|
||||||
|
num_codes = num_NAcodes;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
region = EU;
|
||||||
|
num_codes = num_EUcodes;
|
||||||
|
}
|
||||||
|
for (i = 0 ; i < num_codes; i++)
|
||||||
|
{
|
||||||
|
if (region == NA) {
|
||||||
|
powerCode = NApowerCodes[i];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
powerCode = EUpowerCodes[i];
|
||||||
|
}
|
||||||
|
const uint8_t freq = powerCode->timer_val;
|
||||||
|
const uint8_t numpairs = powerCode->numpairs;
|
||||||
|
M5.Lcd.fillScreen(BLACK);
|
||||||
|
M5.Lcd.setTextSize(4);
|
||||||
|
M5.Lcd.setCursor(5, 1);
|
||||||
|
M5.Lcd.println("TV-B-Gone");
|
||||||
|
M5.Lcd.setTextSize(2);
|
||||||
|
const uint8_t bitcompression = powerCode->bitcompression;
|
||||||
|
code_ptr = 0;
|
||||||
|
for (uint8_t k = 0; k < numpairs; k++) {
|
||||||
|
uint16_t ti;
|
||||||
|
ti = (read_bits(bitcompression)) * 2;
|
||||||
|
offtime = powerCode->times[ti]; // read word 1 - ontime
|
||||||
|
ontime = powerCode->times[ti + 1]; // read word 2 - offtime
|
||||||
|
M5.Lcd.setTextSize(1);
|
||||||
|
M5.Lcd.printf("rti = %d Pair = %d, %d\n", ti >> 1, ontime, offtime);
|
||||||
|
rawData[k * 2] = offtime * 10;
|
||||||
|
rawData[(k * 2) + 1] = ontime * 10;
|
||||||
|
yield();
|
||||||
|
}
|
||||||
|
irsend.sendRaw(rawData, (numpairs * 2) , freq);
|
||||||
|
// Hack: Set IRLED high to turn it off after each burst. Otherwise it stays on (active low)
|
||||||
|
digitalWrite(IRLED, HIGH);
|
||||||
|
yield();
|
||||||
|
bitsleft_r = 0;
|
||||||
|
delay_ten_us(20500);
|
||||||
|
if (digitalRead(TRIGGER) == BUTTON_PRESSED)
|
||||||
|
{
|
||||||
|
while (digitalRead(TRIGGER) == BUTTON_PRESSED) {
|
||||||
|
yield();
|
||||||
|
}
|
||||||
|
endingEarly = true;
|
||||||
|
delay_ten_us(50000); //500ms delay
|
||||||
|
quickflashLEDx(4);
|
||||||
|
delay_ten_us(MAX_WAIT_TIME); // wait 655.350ms
|
||||||
|
delay_ten_us(MAX_WAIT_TIME); // wait 655.350ms
|
||||||
|
break; //exit the POWER code "for" loop
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (endingEarly == false)
|
||||||
|
{
|
||||||
|
delay_ten_us(MAX_WAIT_TIME); // wait 655.350ms
|
||||||
|
delay_ten_us(MAX_WAIT_TIME); // wait 655.350ms
|
||||||
|
quickflashLEDx(8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void delay_ten_us(uint16_t us) {
|
||||||
|
uint8_t timer;
|
||||||
|
while (us != 0) {
|
||||||
|
for (timer = 0; timer <= DELAY_CNT; timer++) {
|
||||||
|
NOP;
|
||||||
|
NOP;
|
||||||
|
}
|
||||||
|
NOP;
|
||||||
|
us--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void quickflashLED( void ) {
|
||||||
|
digitalWrite(LED, LOW);
|
||||||
|
delay_ten_us(3000); // 30 ms ON-time delay
|
||||||
|
digitalWrite(LED, HIGH);
|
||||||
|
}
|
||||||
|
|
||||||
|
void quickflashLEDx( uint8_t x ) {
|
||||||
|
quickflashLED();
|
||||||
|
while (--x) {
|
||||||
|
delay_ten_us(25000); // 250 ms OFF-time delay between flashes
|
||||||
|
quickflashLED();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue