diff --git a/saturn.ino b/saturn.ino index 396e863..1ed7fc7 100644 --- a/saturn.ino +++ b/saturn.ino @@ -26,7 +26,7 @@ IRsend irsend(IR_SEND_PIN); struct Menu { char name[25]; - uint8_t command; + int command; }; struct QrCode { @@ -45,13 +45,13 @@ Menu mainMenu[] = { {"QR Codes", 2}, {TXT_SETTINGS, 3}, }; -uint8_t mainMenuSize = sizeof(mainMenu) / sizeof(Menu); +int mainMenuSize = sizeof(mainMenu) / sizeof(Menu); Menu irDevicesMenu[] = { {"TV", 5}, {TXT_BACK, 0}, }; -uint8_t irDevicesMenuSize = sizeof(irDevicesMenu) / sizeof(Menu); +int irDevicesMenuSize = sizeof(irDevicesMenu) / sizeof(Menu); Menu irTvMenu[] = { {"Power", 7}, @@ -68,7 +68,7 @@ Menu irTvMenu[] = { {"Enter", 17}, {TXT_BACK, 0}, }; -uint8_t irTvMenuSize = sizeof(irTvMenu) / sizeof(Menu); +int irTvMenuSize = sizeof(irTvMenu) / sizeof(Menu); Menu wifiMenu[] = { {TXT_WIFI_SCAN, 4}, @@ -78,7 +78,7 @@ Menu wifiMenu[] = { {"Captive Portal", 5}, {TXT_BACK, 0}, }; -uint8_t wifiMenuSize = sizeof(wifiMenu) / sizeof(Menu); +int wifiMenuSize = sizeof(wifiMenu) / sizeof(Menu); Menu wifiAttackMenu[] = { {TXT_SIGNAL_LEVEL, 3}, @@ -87,7 +87,7 @@ Menu wifiAttackMenu[] = { {TXT_WIFI_COMBINED, 2}, {TXT_BACK, 5}, }; -uint8_t wifiAttackMenuSize = sizeof(wifiAttackMenu) / sizeof(Menu); +int wifiAttackMenuSize = sizeof(wifiAttackMenu) / sizeof(Menu); Menu bluetoothMenu[] = { {"AppleJuice", 1}, @@ -97,7 +97,7 @@ Menu bluetoothMenu[] = { {"BT Maelstrom", 5}, {TXT_BACK, 0}, }; -uint8_t bluetoothMenuSize = sizeof(bluetoothMenu) / sizeof(Menu); +int bluetoothMenuSize = sizeof(bluetoothMenu) / sizeof(Menu); Menu appleJuiceMenu[] = { {"AirPods", 1}, @@ -131,7 +131,7 @@ Menu appleJuiceMenu[] = { {TXT_STP_NW_PH, 28}, {TXT_BACK, 0}, }; -uint8_t appleJuiceMenuSize = sizeof(appleJuiceMenu) / sizeof(Menu); +int appleJuiceMenuSize = sizeof(appleJuiceMenu) / sizeof(Menu); Menu soundMenu[] = { {"Super Mario Bross", 1}, @@ -148,7 +148,7 @@ Menu soundMenu[] = { {"Game Of Thrones", 12}, {TXT_BACK, 0}, }; -uint8_t soundMenuSize = sizeof(soundMenu) / sizeof(Menu); +int soundMenuSize = sizeof(soundMenu) / sizeof(Menu); QrCode qrMenu[] = { {"Saturn", "https://youtu.be/dzNvk80XY9s"}, @@ -159,7 +159,7 @@ QrCode qrMenu[] = { {TXT_REPOSITORY, "https://github.com/henriquesebastiao/saturn"}, {TXT_BACK, ""}, }; -uint8_t qrMenuSize = sizeof(qrMenu) / sizeof(QrCode); +int qrMenuSize = sizeof(qrMenu) / sizeof(QrCode); Menu settingsMenu[] = { {TXT_BATTERY_INFO, 19}, @@ -168,17 +168,17 @@ Menu settingsMenu[] = { // -=-=-= FUNCTIONS OF DRAWING MENUS =-=-=- -void drawMenu(Menu thisMenu[], uint8_t size) { +void drawMenu(Menu thisMenu[], int size) { DISPLAY.fillScreen(BG_COLOR); DISPLAY.setTextSize(MEDIUM_TEXT); DISPLAY.setTextColor(BG_COLOR); - uint8_t y = HEIGHT_MENU_ITEMS; + int y = HEIGHT_MENU_ITEMS; // Scrolling menu if (cursor < 0) { cursor = size - 1; // rollover hack for up-arrow on cardputer } if (cursor > 3) { - for (uint8_t i = 0 + (cursor - 3); i < size; i++) { + for (int i = 0 + (cursor - 3); i < size; i++) { if (cursor == i) { DISPLAY.fillRoundRect(5, y, DISPLAY.width() - 10, 30, 10, MAIN_COLOR); // Highlight the current menu item DISPLAY.setTextColor(BG_COLOR); @@ -192,7 +192,7 @@ void drawMenu(Menu thisMenu[], uint8_t size) { y += SPACING_MENU_ITEMS; // Move to the next position for the next menu item } } else { - for (uint8_t i = 0; i < size; i++) { + for (int i = 0; i < size; i++) { if (cursor == i) { DISPLAY.fillRoundRect(5, y, DISPLAY.width() - 10, 30, 10, MAIN_COLOR); // Highlight the current menu item DISPLAY.setTextColor(BG_COLOR); @@ -208,17 +208,17 @@ void drawMenu(Menu thisMenu[], uint8_t size) { } } -void qrDrawMenu(uint8_t size) { +void qrDrawMenu(int size) { DISPLAY.fillScreen(BG_COLOR); DISPLAY.setTextSize(2); DISPLAY.setTextColor(BG_COLOR); - uint8_t y = HEIGHT_MENU_ITEMS; + int y = HEIGHT_MENU_ITEMS; // Scrolling menu if (cursor < 0) { cursor = size - 1; // rollover hack for up-arrow on cardputer } if (cursor > 3) { - for (uint8_t i = 0 + (cursor - 3); i < size; i++) { + for (int i = 0 + (cursor - 3); i < size; i++) { if (cursor == i) { DISPLAY.fillRoundRect(5, y, DISPLAY.width() - 10, 30, 10, MAIN_COLOR); // Highlight the current menu item DISPLAY.setTextColor(BG_COLOR); @@ -232,7 +232,7 @@ void qrDrawMenu(uint8_t size) { y += SPACING_MENU_ITEMS; // Move to the next position for the next menu item } } else { - for (uint8_t i = 0; i < size; i++) { + for (int i = 0; i < size; i++) { if (cursor == i) { DISPLAY.fillRoundRect(5, y, DISPLAY.width() - 10, 30, 10, MAIN_COLOR); // Highlight the current menu item DISPLAY.setTextColor(BG_COLOR); @@ -453,7 +453,7 @@ void wifiMenuLoop() { delay(250); } if (checkSelectPress()) { - uint8_t option = wifiMenu[cursor].command; + int option = wifiMenu[cursor].command; rstOverride = false; currentProc = 21; isSwitching = true; @@ -485,10 +485,10 @@ void wifiScanDrawMenu() { DISPLAY.fillScreen(BG_COLOR); DISPLAY.setTextSize(MEDIUM_TEXT); DISPLAY.setTextColor(BG_COLOR); - uint8_t y = HEIGHT_MENU_ITEMS; + int y = HEIGHT_MENU_ITEMS; if (cursor > 3) { - for (uint8_t i = 0 + (cursor - 3); i < wifict; i++) { + for (int i = 0 + (cursor - 3); i < wifict; i++) { if (cursor == i) { DISPLAY.fillRoundRect(5, y, DISPLAY.width() - 10, 30, 10, MAIN_COLOR); // Highlight the current menu item DISPLAY.setTextColor(BG_COLOR); @@ -533,7 +533,7 @@ void wifiScanDrawMenu() { DISPLAY.print(TXT_BACK); y += SPACING_MENU_ITEMS; // Move to the next position for the next menu item } else { - for (uint8_t i = 0; i < wifict; i++) { + for (int i = 0; i < wifict; i++) { if (cursor == i) { DISPLAY.fillRoundRect(5, y, DISPLAY.width() - 10, 30, 10, MAIN_COLOR); // Highlight the current menu item DISPLAY.setTextColor(BG_COLOR); @@ -643,11 +643,11 @@ void wifiScanResultLoop(){ DISPLAY.setTextColor(MAIN_COLOR, BG_COLOR); DISPLAY.setTextSize(1.5); - uint8_t y_info = 50; + int y_info = 50; String frequency; - uint8_t numberChannel = WiFi.channel(cursor); + int numberChannel = WiFi.channel(cursor); switch (numberChannel) { @@ -702,7 +702,7 @@ void wifiScanResultLoop(){ String infos[4] = {channelInfo, crypt, bssid, signal}; - for (uint8_t i = 0; i < 4; i++) { + for (int i = 0; i < 4; i++) { DISPLAY.drawString(infos[i], DISPLAY_CENTER_X, y_info); y_info += 15; } @@ -768,7 +768,7 @@ void wifiAttackMenuLoop() { delay(250); } if (checkSelectPress()) { - uint8_t option = wifiAttackMenu[cursor].command; + int option = wifiAttackMenu[cursor].command; rstOverride = false; currentProc = 23; isSwitching = true; @@ -820,16 +820,16 @@ void wifiSignalLevelSetup() { void wifiSignalLevelLoop() { // Reescan networks - uint8_t networks = WiFi.scanNetworks(); - for (uint8_t i = 0; i < networks; i++) { + int networks = WiFi.scanNetworks(); + for (int i = 0; i < networks; i++) { if (WiFi.BSSIDstr(i) == apMac) { cursor = i; break; } } - uint8_t signalLevel = WiFi.RSSI(cursor); - uint8_t signalFeedbackDuration = 100; + int signalLevel = WiFi.RSSI(cursor); + int signalFeedbackDuration = 100; String signal = String(WiFi.RSSI(cursor)) + "dbm"; String ssid = WiFi.SSID(cursor); String channel = String(WiFi.channel(cursor)); @@ -848,7 +848,7 @@ void wifiSignalLevelLoop() { DISPLAY.setTextSize(LARGE_TEXT); DISPLAY.drawString(signal, DISPLAY_CENTER_X, 100); - uint8_t frequency; + int frequency; if (signalLevel == 0) { frequency = 100; @@ -885,7 +885,7 @@ void wifiSignalLevelLoop() { // -=-=-= DEAUTH =-=-=- void deauthSetup(){ - // Start the Access pouint8_t service as Hidden + // Start the Access point service as Hidden WiFi.mode(WIFI_AP); WiFi.softAP(apSsidName, emptyString, channel, 1, 4, false); IPAddress apIP = WiFi.softAPIP(); @@ -1004,7 +1004,7 @@ void portalLoop(){ void wifiBeaconSetup() { // Create empty SSID - for (uint8_t i = 0; i < 32; i++) + for (int i = 0; i < 32; i++) emptySSID[i] = ' '; // For random generator randomSeed(1); @@ -1034,7 +1034,7 @@ void wifiBeaconSetup() { DISPLAY.setCursor(0, 0); DISPLAY.print(TXT_BEACON_ATTACK); - uint8_t ct = 0; + int ct = 0; const char *str; switch(beaconType) { case 1: @@ -1056,8 +1056,8 @@ void wifiBeaconSetup() { } void wifiBeaconLoop() { - uint8_t i = 0; - uint8_t len = 0; + int i = 0; + int len = 0; switch(beaconType) { case 1: len = sizeof(funnySSIDs); @@ -1108,7 +1108,7 @@ void bluetoothMenuLoop() { delay(250); } if (checkSelectPress()) { - uint8_t option = bluetoothMenu[cursor].command; + int option = bluetoothMenu[cursor].command; DISPLAY.fillScreen(BG_COLOR); DISPLAY.setTextSize(MEDIUM_TEXT); @@ -1351,7 +1351,7 @@ void appleJuiceAdvertisingLoop(){ packet[i++] = 0x10; // Type ??? esp_fill_random(&packet[i], 3); oAdvertisementData.addData(std::string((char *)packet, 17)); - for (uint8_t i = 0; i < sizeof packet; i ++) { + for (int i = 0; i < sizeof packet; i ++) { Serial.printf("%02x", packet[i]); } Serial.println(""); @@ -1369,10 +1369,10 @@ void appleJuiceAdvertisingLoop(){ packet[i++] = 0x03; // Microsoft Beacon ID packet[i++] = 0x00; // Microsoft Beacon Sub Scenario packet[i++] = 0x80; // Reserved RSSI Byte - for (uint8_t j = 0; j < display_name_len; j++) { + for (int j = 0; j < display_name_len; j++) { packet[i + j] = display_name[j]; } - for (uint8_t i = 0; i < size; i ++) { + for (int i = 0; i < size; i ++) { Serial.printf("%02x", packet[i]); } Serial.println(""); @@ -1402,7 +1402,7 @@ void appleJuiceAdvertisingLoop(){ packet[i++] = (rand() % 120) - 100; // -100 to +20 dBm oAdvertisementData.addData(std::string((char *)packet, 14)); - for (uint8_t i = 0; i < sizeof packet; i ++) { + for (int i = 0; i < sizeof packet; i ++) { Serial.printf("%02x", packet[i]); } Serial.println(""); @@ -1413,7 +1413,7 @@ void appleJuiceAdvertisingLoop(){ } else { oAdvertisementData.addData(std::string((char*)data, sizeof(Airpods))); } - for (uint8_t i = 0; i < sizeof(Airpods); i ++) { + for (int i = 0; i < sizeof(Airpods); i ++) { Serial.printf("%02x", data[i]); } Serial.println(""); @@ -1496,7 +1496,7 @@ void soundMenuLoop() { delay(250); } if (checkSelectPress()) { - uint8_t option = soundMenu[cursor].command; + int option = soundMenu[cursor].command; delay(500); // Prevents audio from going on and off immediately because you haven't released the button yet rstOverride = false; isSwitching = true; @@ -1571,7 +1571,7 @@ void voiceRecorderSetup() { void voiceRecorderLoop() { M5Cardputer.update(); if (MIC.isEnabled()) { - static constexpr uint8_t shift = 6; + static constexpr int shift = 6; auto data = &rec_data[rec_record_idx * record_length]; if (MIC.record(data, record_length, record_samplerate)) { data = &rec_data[draw_record_idx * record_length]; @@ -1636,7 +1636,7 @@ void voiceRecorderLoop() { DISPLAY.fillTriangle(70 - 8, 15 - 8, 70 - 8, 15 + 8, 70 + 8, 15, 0x1c9f); DISPLAY.drawString("PLAY", 120, 10); - uint8_t start_pos = rec_record_idx * record_length; + int start_pos = rec_record_idx * record_length; if (start_pos < record_size) { SPEAKER.playRaw(&rec_data[start_pos], record_size - start_pos, record_samplerate, false, 1, 0); @@ -1707,17 +1707,17 @@ void qrMenuLoop() { } bool screen_dim_dimmed = false; -uint8_t screen_dim_current = 0; -uint8_t screen_dim_time = 30; +int screen_dim_current = 0; +int screen_dim_time = 30; -void screenBrightness(uint8_t bright){ +void screenBrightness(int bright){ #if defined(BACKLIGHT) - uint8_t bl = MINBRIGHT + round(((255 - MINBRIGHT) * bright / 100)); + int bl = MINBRIGHT + round(((255 - MINBRIGHT) * bright / 100)); analogWrite(BACKLIGHT, bl); #endif } -uint8_t uptime(){ +int uptime(){ return(int(millis() / 1000)); } @@ -1731,13 +1731,13 @@ void dimTimer(){ // -=-=-= IR FUNCTIONS =-=-=- -void sendIrRawCodes(uint16_t *codes[], uint8_t sizes[], String name) { - uint8_t size_all_codes = sizeof(codes) / sizeof(uint16_t*); +void sendIrRawCodes(uint16_t *codes[], int sizes[], String name) { + int size_all_codes = sizeof(codes) / sizeof(uint16_t*); bool endingEarly = false; - for (uint8_t i = 0; i < size_all_codes; i++) { - uint8_t size = sizes[i]; + for (int i = 0; i < size_all_codes; i++) { + int size = sizes[i]; DISPLAY.fillScreen(BG_COLOR); DISPLAY.setTextSize(LARGE_TEXT); DISPLAY.drawString(name, DISPLAY_CENTER_X, 50); @@ -1759,13 +1759,13 @@ void sendIrRawCodes(uint16_t *codes[], uint8_t sizes[], String name) { } } -void sendIrProntoCodes(uint16_t *codes[], uint8_t sizes[], String name) { - uint8_t size_all_codes = sizeof(codes) / sizeof(uint16_t*); +void sendIrProntoCodes(uint16_t *codes[], int sizes[], String name) { + int size_all_codes = sizeof(codes) / sizeof(uint16_t*); bool endingEarly = false; - for (uint8_t i = 0; i < size_all_codes; i++) { - uint8_t size = sizes[i]; + for (int i = 0; i < size_all_codes; i++) { + int size = sizes[i]; DISPLAY.fillScreen(BG_COLOR); DISPLAY.setTextSize(LARGE_TEXT); DISPLAY.drawString(name, DISPLAY_CENTER_X, 50); @@ -1847,7 +1847,7 @@ void batteryDrawMenu(uint8_t battery) { DISPLAY.setTextColor(MAIN_COLOR, BG_COLOR); } -uint8_t getBatteryVoltage() { +int getBatteryVoltage() { return M5.Power.getBatteryLevel(); } diff --git a/src/applejuice.h b/src/applejuice.h index 5c4ccae..b8bca91 100644 --- a/src/applejuice.h +++ b/src/applejuice.h @@ -110,7 +110,7 @@ uint8_t AppleVisionPro[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x24, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}; uint8_t* data; -uint8_t deviceType = 0; +int deviceType = 0; struct DeviceType { uint32_t value; @@ -319,8 +319,7 @@ DeviceType android_models[] = { {0x92ADC9, "Ton Upgrade Netflix"}, }; -uint8_t android_models_count = - (sizeof(android_models) / sizeof(android_models[0])); +int android_models_count = (sizeof(android_models) / sizeof(android_models[0])); BLEAdvertisementData oAdvertisementData = BLEAdvertisementData(); BLEAdvertising* pAdvertising; \ No newline at end of file diff --git a/src/beacon.h b/src/beacon.h index e3c4f58..1eccacd 100644 --- a/src/beacon.h +++ b/src/beacon.h @@ -10,7 +10,7 @@ const uint8_t channels[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; // default for LANGUAGE_EN_US #endif const bool wpa2 = true; // WPA2 networks -uint8_t beaconType = 1; // 1 = funny, 2 = rickroll, maybe more later +int beaconType = 1; // 1 = funny, 2 = rickroll, maybe more later /* SSIDs: @@ -136,10 +136,10 @@ esp_err_t esp_wifi_80211_tx(wifi_interface_t ifx, const void* buffer, int len, const char* generateRandomName() { const char* charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; - uint8_t len = rand() % 10 + 1; // Generate a random length between 1 and 10 + int len = rand() % 10 + 1; // Generate a random length between 1 and 10 char* randomName = (char*)malloc( (len + 1) * sizeof(char)); // Allocate memory for the random name - for (uint8_t i = 0; i < len; ++i) { + for (int i = 0; i < len; ++i) { randomName[i] = charset[rand() % strlen(charset)]; // Select random characters from the charset @@ -150,8 +150,8 @@ const char* generateRandomName() { char* randomSSID() { const char* charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; - uint8_t len = rand() % 22 + 7; // Generate a random length between 1 and 10 - for (uint8_t i = 0; i < len; ++i) { + int len = rand() % 22 + 7; // Generate a random length between 1 and 10 + for (int i = 0; i < len; ++i) { randomName[i] = charset[rand() % strlen(charset)]; // S elect random characters from the charset @@ -243,11 +243,11 @@ void nextChannel() { void beaconSpamList(const char list[]) { // temp variables - uint8_t i = 0; - uint8_t j = 0; - uint8_t ssidNum = 1; + int i = 0; + int j = 0; + int ssidNum = 1; char tmp; - uint8_t ssidsLen = strlen_P(list); + int ssidsLen = strlen_P(list); bool sent = false; // go to next channel @@ -281,7 +281,7 @@ void beaconSpamList(const char list[]) { beaconPacket[82] = wifi_channel; // send packet - for (uint8_t k = 0; k < 3; k++) { + for (int k = 0; k < 3; k++) { packetCounter += esp_wifi_80211_tx(WIFI_IF_STA, beaconPacket, packetSize, 0) == 0; delay(1); diff --git a/src/infrared.h b/src/infrared.h index 504b157..7766992 100644 --- a/src/infrared.h +++ b/src/infrared.h @@ -64,7 +64,7 @@ uint16_t *allIrPowerCodesProntoTV[] = { irPowerCodesProntoToshibaTV, }; -uint8_t allIrPowerCodesProntoTVLength[] = { +int allIrPowerCodesProntoTVLength[] = { 78, 28, 76, @@ -102,7 +102,7 @@ uint8_t allIrPowerCodesProntoTVLength[] = { // irPowerCodesRawTVPanasonic58JX800Series, // }; -// uint8_t allIrPowerCodesRawTVLength[] = { +// int allIrPowerCodesRawTVLength[] = { // 299, // }; @@ -144,7 +144,7 @@ uint16_t *allIrMuteCodesProntoTV[] = { irMuteCodesProntoToshibaTV, }; -uint8_t allIrMuteCodesProntoTVLength[] = { +int allIrMuteCodesProntoTVLength[] = { 72, 28, 76, @@ -165,7 +165,7 @@ uint8_t allIrMuteCodesProntoTVLength[] = { // irMuteCodesRawTVPanasonic58JX800Series, // }; -// uint8_t allIrMuteCodesRawTVLength[] = { +// int allIrMuteCodesRawTVLength[] = { // 99, // }; @@ -208,7 +208,7 @@ uint16_t *allIrVolumeUpCodesProntoTV[] = { irVolumeUpCodesProntoToshibaTV, }; -uint8_t allIrVolumeUpCodesProntoTVLength[] = { +int allIrVolumeUpCodesProntoTVLength[] = { 72, 28, 76, @@ -217,7 +217,7 @@ uint8_t allIrVolumeUpCodesProntoTVLength[] = { // uint16_t *allIrVolumeUpCodesRawTV[] = { // }; -// uint8_t allIrVolumeUpCodesRawTVLength[] = { +// int allIrVolumeUpCodesRawTVLength[] = { // }; // --> VOLUME DOWN @@ -259,7 +259,7 @@ uint16_t *allIrVolumeDownCodesProntoTV[] = { irVolumeDownCodesProntoToshibaTV, }; -uint8_t allIrVolumeDownCodesProntoTVLength[] = { +int allIrVolumeDownCodesProntoTVLength[] = { 72, 28, 76, @@ -268,7 +268,7 @@ uint8_t allIrVolumeDownCodesProntoTVLength[] = { // uint16_t *allIrVolumeDownCodesRawTV[] = { // }; -// uint8_t allIrVolumeDownCodesRawTVLength[] = { +// int allIrVolumeDownCodesRawTVLength[] = { // }; // --> CHANNEL UP @@ -310,7 +310,7 @@ uint16_t *allIrChannelUpCodesProntoTV[] = { irChannelUpCodesProntoToshibaTV, }; -uint8_t allIrChannelUpCodesProntoTVLength[] = { +int allIrChannelUpCodesProntoTVLength[] = { 72, 28, 76, @@ -319,7 +319,7 @@ uint8_t allIrChannelUpCodesProntoTVLength[] = { // uint16_t *allIrChannelUpCodesRawTV[] = { // }; -// uint8_t allIrChannelUpCodesRawTVLength[] = { +// int allIrChannelUpCodesRawTVLength[] = { // }; // --> CHANNEL DOWN @@ -361,7 +361,7 @@ uint16_t *allIrChannelDownCodesProntoTV[] = { irChannelDownCodesProntoToshibaTV, }; -uint8_t allIrChannelDownCodesProntoTVLength[] = { +int allIrChannelDownCodesProntoTVLength[] = { 72, 28, 76, @@ -370,7 +370,7 @@ uint8_t allIrChannelDownCodesProntoTVLength[] = { // uint16_t *allIrChannelDownCodesRawTV[] = { // }; -// uint8_t allIrChannelDownCodesRawTVLength[] = { +// int allIrChannelDownCodesRawTVLength[] = { // }; // --> MENU @@ -398,7 +398,7 @@ uint16_t *allIrMenuCodesProntoTV[] = { irMenuCodesProntoPhilipsTV, }; -uint8_t allIrMenuCodesProntoTVLength[] = { +int allIrMenuCodesProntoTVLength[] = { 72, 28, }; @@ -406,7 +406,7 @@ uint8_t allIrMenuCodesProntoTVLength[] = { // uint16_t *allIrMenuCodesRawTV[] = { // }; -// uint8_t allIrMenuCodesRawTVLength[] = { +// int allIrMenuCodesRawTVLength[] = { // }; // --> UP @@ -434,7 +434,7 @@ uint16_t *allIrUpCodesProntoTV[] = { irUpCodesProntoPhilipsTV, }; -uint8_t allIrUpCodesProntoTVLength[] = { +int allIrUpCodesProntoTVLength[] = { 72, 28, }; @@ -442,7 +442,7 @@ uint8_t allIrUpCodesProntoTVLength[] = { // uint16_t *allIrUpCodesRawTV[] = { // }; -// uint8_t allIrUpCodesRawTVLength[] = { +// int allIrUpCodesRawTVLength[] = { // }; // --> DOWN @@ -470,7 +470,7 @@ uint16_t *allIrDownCodesProntoTV[] = { irDownCodesProntoPhilipsTV, }; -uint8_t allIrDownCodesProntoTVLength[] = { +int allIrDownCodesProntoTVLength[] = { 72, 28, }; @@ -478,7 +478,7 @@ uint8_t allIrDownCodesProntoTVLength[] = { // uint16_t *allIrDownCodesRawTV[] = { // }; -// uint8_t allIrDownCodesRawTVLength[] = { +// int allIrDownCodesRawTVLength[] = { // }; // --> LEFT @@ -505,7 +505,7 @@ uint16_t *allIrLeftCodesProntoTV[] = { irLeftCodesProntoPhilipsTV, }; -uint8_t allIrLeftCodesProntoTVLength[] = { +int allIrLeftCodesProntoTVLength[] = { 72, 28, }; @@ -513,7 +513,7 @@ uint8_t allIrLeftCodesProntoTVLength[] = { // uint16_t *allIrLeftCodesRawTV[] = { // }; -// uint8_t allIrLeftCodesRawTVLength[] = { +// int allIrLeftCodesRawTVLength[] = { // }; // --> RIGHT @@ -540,7 +540,7 @@ uint16_t *allIrRightCodesProntoTV[] = { irRightCodesProntoPhilipsTV, }; -uint8_t allIrRightCodesProntoTVLength[] = { +int allIrRightCodesProntoTVLength[] = { 72, 28, }; @@ -548,7 +548,7 @@ uint8_t allIrRightCodesProntoTVLength[] = { // uint16_t *allIrRightCodesRawTV[] = { // }; -// uint8_t allIrRightCodesRawTVLength[] = { +// int allIrRightCodesRawTVLength[] = { // }; // --> ENTER @@ -576,7 +576,7 @@ uint16_t *allIrEnterCodesProntoTV[] = { irEnterCodesProntoPhilipsTV, }; -uint8_t allIrEnterCodesProntoTVLength[] = { +int allIrEnterCodesProntoTVLength[] = { 72, 28, }; @@ -584,5 +584,5 @@ uint8_t allIrEnterCodesProntoTVLength[] = { // uint16_t *allIrEnterCodesRawTV[] = { // }; -// uint8_t allIrEnterCodesRawTVLength[] = { +// int allIrEnterCodesRawTVLength[] = { // }; \ No newline at end of file diff --git a/src/sounds.h b/src/sounds.h index de64498..cca0411 100644 --- a/src/sounds.h +++ b/src/sounds.h @@ -10,8 +10,8 @@ bool checkExitPress() { } struct Melody { - uint8_t note; - uint8_t duration; + int note; + int duration; }; Melody superMarioMelody[] = { @@ -42,9 +42,9 @@ Melody superMarioMelody[] = { {660, 80}, {500, 80}, {430, 80}, {380, 80}, {660, 100}, {660, 100}, {660, 100}, {510, 100}, {660, 100}, {770, 100}, {380, 100}, }; -uint8_t superMarioMelodySize = sizeof(superMarioMelody) / sizeof(Melody); +int superMarioMelodySize = sizeof(superMarioMelody) / sizeof(Melody); -uint8_t superMarioDelay[] = { +int superMarioDelay[] = { 300, 300, 100, 300, 550, 575, 450, 400, 500, 300, 330, 150, 300, 200, 200, 150, 300, 150, 350, 300, 150, 150, 500, 450, 400, 500, 300, 330, 150, 300, 200, 200, 150, 300, 150, 350, 300, 150, 150, 500, 300, 100, 150, 150, 300, @@ -59,7 +59,7 @@ uint8_t superMarioDelay[] = { }; void superMarioBrossSound() { - for (uint8_t note = 0; note < superMarioMelodySize; note++) { + for (int note = 0; note < superMarioMelodySize; note++) { M5Cardputer.Speaker.tone(superMarioMelody[note].note, superMarioMelody[note].duration); @@ -76,15 +76,15 @@ Melody imperialMarchMelody[] = { {400, 500}, {600, 200}, {500, 500}, {750, 500}, {750, 500}, {750, 500}, {810, 500}, {600, 200}, {470, 500}, {400, 500}, {600, 200}, {500, 500}, }; -uint8_t imperialMarchMelodySize = sizeof(imperialMarchMelody) / sizeof(Melody); +int imperialMarchMelodySize = sizeof(imperialMarchMelody) / sizeof(Melody); -uint8_t imperialMarchDelay[] = { +int imperialMarchDelay[] = { 500, 500, 500, 400, 100, 500, 400, 100, 1000, 500, 500, 500, 400, 100, 500, 400, 100, 1000, }; void imperialMarchSound() { - for (uint8_t note = 0; note < imperialMarchMelodySize; note++) { + for (int note = 0; note < imperialMarchMelodySize; note++) { M5Cardputer.Speaker.tone(imperialMarchMelody[note].note, imperialMarchMelody[note].duration); @@ -106,9 +106,9 @@ Melody ahaTakeOnMeMelody[] = { {880, 188}, {880, 188}, {880, 188}, {659, 188}, {587, 188}, {740, 188}, {740, 188}, {740, 188}, {659, 188}, {659, 188}, {740, 188}, {659, 188}, }; -uint8_t ahaTakeOnMeMelodySize = sizeof(ahaTakeOnMeMelody) / sizeof(Melody); +int ahaTakeOnMeMelodySize = sizeof(ahaTakeOnMeMelody) / sizeof(Melody); -uint8_t ahaTakeOnMeDelay[] = { +int ahaTakeOnMeDelay[] = { 198, 198, 198, 198, 188, 198, 188, 198, 188, 198, 188, 198, 198, 198, 198, 198, 198, 198, 198, 198, 188, 198, 188, 198, 188, 198, 188, 198, 198, 198, 198, 198, 198, 198, 198, 198, 188, 198, 188, @@ -117,7 +117,7 @@ uint8_t ahaTakeOnMeDelay[] = { }; void ahaTakeOnMeSound() { - for (uint8_t note = 0, iDelay = 0; note < ahaTakeOnMeMelodySize; note++) { + for (int note = 0, iDelay = 0; note < ahaTakeOnMeMelodySize; note++) { M5Cardputer.Speaker.tone(ahaTakeOnMeMelody[note].note, ahaTakeOnMeMelody[note].duration); @@ -142,15 +142,15 @@ Melody jingleBellsMelody[] = { {553, 220}, {553, 300}, {553, 220}, {523, 220}, {523, 250}, {523, 220}, {470, 220}, {470, 220}, {523, 300}, {470, 600}, }; -uint8_t jingleBellsMelodySize = sizeof(jingleBellsMelody) / sizeof(Melody); +int jingleBellsMelodySize = sizeof(jingleBellsMelody) / sizeof(Melody); -uint8_t jingleBellsDelay[] = { +int jingleBellsDelay[] = { 250, 250, 500, 250, 250, 500, 250, 250, 250, 250, 1000, 250, 250, 500, 250, 250, 500, 250, 250, 250, 350, 1000, }; void jingleBellsSound() { - for (uint8_t note = 0; note < jingleBellsMelodySize; note++) { + for (int note = 0; note < jingleBellsMelodySize; note++) { M5Cardputer.Speaker.tone(jingleBellsMelody[note].note, jingleBellsMelody[note].duration); @@ -194,10 +194,10 @@ Melody ozzyOsbornCrazyTrainMelody[] = { {740, 175}, {659, 175}, {659, 175}, {587, 375}, {659, 175}, {587, 175}, {554, 175}, {440, 775}, }; -uint8_t ozzyOsbornCrazyTrainMelodySize = +int ozzyOsbornCrazyTrainMelodySize = sizeof(ozzyOsbornCrazyTrainMelody) / sizeof(Melody); -uint8_t ozzyOsbornCrazyTrainDelay[] = { +int ozzyOsbornCrazyTrainDelay[] = { 200, 200, 1200, 200, 200, 400, 200, 200, 400, 200, 200, 1200, 200, 200, 400, 200, 200, 400, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, @@ -214,7 +214,7 @@ uint8_t ozzyOsbornCrazyTrainDelay[] = { }; void ozzyOsbornCrazyTrainSound() { - for (uint8_t note = 0; note < ozzyOsbornCrazyTrainMelodySize; note++) { + for (int note = 0; note < ozzyOsbornCrazyTrainMelodySize; note++) { Serial.printf("note: %d, duration: %d\n", ozzyOsbornCrazyTrainMelody[note].note, ozzyOsbornCrazyTrainMelody[note].duration); @@ -247,16 +247,16 @@ Melody starWarsMelody[] = { {1175, 167}, {1047, 167}, {1865, 1000}, {1397, 500}, {1245, 167}, {1175, 167}, {1245, 167}, {1047, 667}, }; -uint8_t starWarsMelodySize = sizeof(starWarsMelody) / sizeof(Melody); +int starWarsMelodySize = sizeof(starWarsMelody) / sizeof(Melody); -uint8_t starWarsDelay[] = { +int starWarsDelay[] = { 177, 177, 177, 1010, 1010, 177, 177, 177, 1010, 510, 177, 177, 177, 1010, 510, 177, 177, 177, 677, 333, 177, 177, 177, 1010, 1010, 177, 177, 177, 1010, 510, 177, 177, 177, 1010, 510, 177, 177, 177, 677, }; void starWarsSound() { - for (uint8_t note = 0, iDelay = 0; note < starWarsMelodySize; note++) { + for (int note = 0, iDelay = 0; note < starWarsMelodySize; note++) { M5Cardputer.Speaker.tone(starWarsMelody[note].note, starWarsMelody[note].duration); @@ -275,19 +275,19 @@ void starWarsSound() { } } -uint8_t nokiaMelody[] = {NOTE_E5, NOTE_D5, NOTE_FS4, NOTE_GS4, NOTE_CS5, - NOTE_B4, NOTE_D4, NOTE_E4, NOTE_B4, NOTE_A4, - NOTE_CS4, NOTE_E4, NOTE_A4}; +int nokiaMelody[] = {NOTE_E5, NOTE_D5, NOTE_FS4, NOTE_GS4, NOTE_CS5, + NOTE_B4, NOTE_D4, NOTE_E4, NOTE_B4, NOTE_A4, + NOTE_CS4, NOTE_E4, NOTE_A4}; -uint8_t nokiaDurations[] = {8, 8, 4, 4, 8, 8, 4, 4, 8, 8, 4, 4, 2}; -uint8_t nokiaDurationsSize = sizeof(nokiaDurations) / sizeof(uint8_t); +int nokiaDurations[] = {8, 8, 4, 4, 8, 8, 4, 4, 8, 8, 4, 4, 2}; +int nokiaDurationsSize = sizeof(nokiaDurations) / sizeof(int); void nokiaSound() { - for (uint8_t note = 0; note < nokiaDurationsSize; note++) { - uint8_t duration = 1000 / nokiaDurations[note]; + for (int note = 0; note < nokiaDurationsSize; note++) { + int duration = 1000 / nokiaDurations[note]; M5Cardputer.Speaker.tone(nokiaMelody[note], duration); - uint8_t pauseBetweenNotes = duration * 1.30; + int pauseBetweenNotes = duration * 1.30; if (checkExitPress()) { return; @@ -297,22 +297,21 @@ void nokiaSound() { } } -uint8_t theSimpsonsMelody[] = { +int theSimpsonsMelody[] = { NOTE_C4, NOTE_E4, NOTE_FS4, REST, NOTE_A4, NOTE_G4, NOTE_E4, NOTE_C4, NOTE_A3, NOTE_FS3, NOTE_FS3, NOTE_FS3, NOTE_G3, REST, NOTE_FS3, NOTE_FS3, NOTE_FS3, NOTE_G3, NOTE_AS3, NOTE_B3, REST}; -uint8_t theSimpsonsDurations[] = {2, 4, 4, 32, 8, 2, 4, 4, 8, 8, 8, - 8, 4, 2, 8, 8, 8, 4, 2, 2, 2}; -uint8_t theSimpsonsDurationSize = - sizeof(theSimpsonsDurations) / sizeof(uint8_t); +int theSimpsonsDurations[] = {2, 4, 4, 32, 8, 2, 4, 4, 8, 8, 8, + 8, 4, 2, 8, 8, 8, 4, 2, 2, 2}; +int theSimpsonsDurationSize = sizeof(theSimpsonsDurations) / sizeof(int); void theSimpsonsSound() { - for (uint8_t note = 0; note < theSimpsonsDurationSize; note++) { - uint8_t duration = 1000 / theSimpsonsDurations[note]; + for (int note = 0; note < theSimpsonsDurationSize; note++) { + int duration = 1000 / theSimpsonsDurations[note]; M5Cardputer.Speaker.tone(theSimpsonsMelody[note], duration); - uint8_t pauseBetweenNotes = duration * 1.30; + int pauseBetweenNotes = duration * 1.30; if (checkExitPress()) { return; @@ -322,26 +321,26 @@ void theSimpsonsSound() { } } -uint8_t pacmanMelody[] = { - NOTE_B4, NOTE_B5, NOTE_FS5, NOTE_DS5, NOTE_B5, NOTE_FS5, NOTE_DS5, - NOTE_C5, NOTE_C6, NOTE_G6, NOTE_E6, NOTE_C6, NOTE_G6, NOTE_E6, +int pacmanMelody[] = {NOTE_B4, NOTE_B5, NOTE_FS5, NOTE_DS5, NOTE_B5, NOTE_FS5, + NOTE_DS5, NOTE_C5, NOTE_C6, NOTE_G6, NOTE_E6, NOTE_C6, + NOTE_G6, NOTE_E6, - NOTE_B4, NOTE_B5, NOTE_FS5, NOTE_DS5, NOTE_B5, NOTE_FS5, NOTE_DS5, - NOTE_DS5, NOTE_E5, NOTE_F5, NOTE_F5, NOTE_FS5, NOTE_G5, NOTE_G5, - NOTE_GS5, NOTE_A5, NOTE_B5}; + NOTE_B4, NOTE_B5, NOTE_FS5, NOTE_DS5, NOTE_B5, NOTE_FS5, + NOTE_DS5, NOTE_DS5, NOTE_E5, NOTE_F5, NOTE_F5, NOTE_FS5, + NOTE_G5, NOTE_G5, NOTE_GS5, NOTE_A5, NOTE_B5}; -uint8_t pacmanDurations[] = { - 16, 16, 16, 16, 32, 16, 8, 16, 16, 16, 16, 32, 16, 8, +int pacmanDurations[] = {16, 16, 16, 16, 32, 16, 8, 16, 16, 16, 16, 32, 16, 8, - 16, 16, 16, 16, 32, 16, 8, 32, 32, 32, 32, 32, 32, 32, 32, 16, 8}; -uint8_t pacmanDurationSize = sizeof(pacmanDurations) / sizeof(uint8_t); + 16, 16, 16, 16, 32, 16, 8, 32, 32, 32, 32, 32, 32, 32, + 32, 16, 8}; +int pacmanDurationSize = sizeof(pacmanDurations) / sizeof(int); void pacmanSound() { - for (uint8_t note = 0; note < pacmanDurationSize; note++) { - uint8_t duration = 1000 / pacmanDurations[note]; + for (int note = 0; note < pacmanDurationSize; note++) { + int duration = 1000 / pacmanDurations[note]; M5Cardputer.Speaker.tone(pacmanMelody[note], duration); - uint8_t pauseBetweenNotes = duration * 1.30; + int pauseBetweenNotes = duration * 1.30; if (checkExitPress()) { return; @@ -351,7 +350,7 @@ void pacmanSound() { } } -uint8_t doomMelody[] = { +int doomMelody[] = { NOTE_E2, NOTE_E2, NOTE_E3, NOTE_E2, NOTE_E2, NOTE_D3, NOTE_E2, NOTE_E2, NOTE_C3, NOTE_E2, NOTE_E2, NOTE_AS2, NOTE_E2, NOTE_E2, NOTE_B2, NOTE_C3, NOTE_E2, NOTE_E2, NOTE_E3, NOTE_E2, NOTE_E2, @@ -478,7 +477,7 @@ uint8_t doomMelody[] = { NOTE_E3, NOTE_G3, NOTE_C4, NOTE_B3, NOTE_G3, NOTE_B3, NOTE_G3, NOTE_E3}; -uint8_t doomDurations[] = { +int doomDurations[] = { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 2, @@ -544,14 +543,14 @@ uint8_t doomDurations[] = { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16}; -uint8_t doomDurationsSize = sizeof(doomDurations) / sizeof(uint8_t); +int doomDurationsSize = sizeof(doomDurations) / sizeof(int); void doomSound() { - for (uint8_t note = 0; note < doomDurationsSize; note++) { - uint8_t duration = 1000 / doomDurations[note]; + for (int note = 0; note < doomDurationsSize; note++) { + int duration = 1000 / doomDurations[note]; M5Cardputer.Speaker.tone(doomMelody[note], duration); - uint8_t pauseBetweenNotes = duration * 1.30; + int pauseBetweenNotes = duration * 1.30; if (checkExitPress()) { return; @@ -561,7 +560,7 @@ void doomSound() { } } -uint8_t shapeOfYouMelody[] = { +int shapeOfYouMelody[] = { NOTE_CS4, NOTE_E4, NOTE_CS4, NOTE_CS4, NOTE_E4, NOTE_CS4, NOTE_CS4, NOTE_E4, NOTE_CS4, NOTE_DS4, NOTE_CS4, NOTE_CS4, NOTE_E4, NOTE_CS4, NOTE_B3, NOTE_CS4, NOTE_E4, NOTE_CS4, NOTE_CS4, NOTE_E4, NOTE_CS4, @@ -609,7 +608,7 @@ uint8_t shapeOfYouMelody[] = { NOTE_E4, NOTE_FS4, NOTE_CS4, }; -uint8_t shapeOfYouDurations[] = { +int shapeOfYouDurations[] = { 2, 2, 4, 2, 2, 4, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 4, 2, 2, 2, 2, 8, 8, 4, 4, 8, 8, 8, 8, 8, 8, 8, 2, 8, 8, 4, 2, 8, 8, 4, 8, 8, 8, 4, 4, 8, 8, 8, 8, 8, 4, 8, 4, 8, 8, 8, 8, 4, 2, 8, 8, 8, 8, 4, 8, 8, 8, 8, @@ -623,14 +622,14 @@ uint8_t shapeOfYouDurations[] = { 4, 8, 2, 8, 8, 4, 8, 8, 8, 4, 8, 4, 4, 4, 4, 4, 4, 4, 2, 8, 8, 4, 8, 8, 8, 4, 8, 4, 4, 4, 4, 4, 4, 4, 2, 8, 8, 4, 8, 8, 8, 4, 8, 4, 4, 4, 4, 4, 4, 4, 2, 8, 8, 4, 8, 8, 8, 4, 8, 4, 8, 8, 8, 8, 8, 8, 4, 4, 4, 4, 2}; -uint8_t shapeOfYouDurationsSize = sizeof(shapeOfYouDurations) / sizeof(uint8_t); +int shapeOfYouDurationsSize = sizeof(shapeOfYouDurations) / sizeof(int); void shapeOfYouSound() { - for (uint8_t note = 0; note < shapeOfYouDurationsSize; note++) { - uint8_t duration = 1000 / shapeOfYouDurations[note]; + for (int note = 0; note < shapeOfYouDurationsSize; note++) { + int duration = 1000 / shapeOfYouDurations[note]; M5Cardputer.Speaker.tone(shapeOfYouMelody[note], duration); - uint8_t pauseBetweenNotes = duration * 1.30; + int pauseBetweenNotes = duration * 1.30; if (checkExitPress()) { return; @@ -640,7 +639,7 @@ void shapeOfYouSound() { } } -uint8_t gameOfThronesMelody[] = { +int gameOfThronesMelody[] = { NOTE_G4, NOTE_C4, NOTE_DS4, NOTE_F4, NOTE_G4, NOTE_C4, NOTE_DS4, NOTE_F4, NOTE_G4, NOTE_C4, NOTE_DS4, NOTE_F4, NOTE_G4, NOTE_C4, NOTE_DS4, NOTE_F4, NOTE_G4, NOTE_C4, NOTE_E4, NOTE_F4, NOTE_G4, @@ -671,7 +670,7 @@ uint8_t gameOfThronesMelody[] = { NOTE_C6, NOTE_G5, NOTE_GS5, NOTE_AS5, NOTE_C6, NOTE_G5, NOTE_GS5, NOTE_AS5}; -uint8_t gameOfThronesDurations[] = { +int gameOfThronesDurations[] = { 8, 8, 16, 16, 8, 8, 16, 16, 8, 8, 16, 16, 8, 8, 16, 16, 8, 8, 16, 16, 8, 8, 16, 16, 8, 8, 16, 16, 8, 8, 16, 16, 4, 4, @@ -688,15 +687,14 @@ uint8_t gameOfThronesDurations[] = { 16, 16, 8, 8, 16, 16, 4, 16, 16, 8, 8, 16, 16, 8, 16, 16, 16, 8, 8, 16, 16}; -uint8_t gameOfThronesDurationsSize = - sizeof(gameOfThronesDurations) / sizeof(uint8_t); +int gameOfThronesDurationsSize = sizeof(gameOfThronesDurations) / sizeof(int); void gameOfThronesSound() { - for (uint8_t note = 0; note < gameOfThronesDurationsSize; note++) { - uint8_t duration = 1000 / gameOfThronesDurations[note]; + for (int note = 0; note < gameOfThronesDurationsSize; note++) { + int duration = 1000 / gameOfThronesDurations[note]; M5Cardputer.Speaker.tone(gameOfThronesMelody[note], duration); - uint8_t pauseBetweenNotes = duration * 1.30; + int pauseBetweenNotes = duration * 1.30; if (checkExitPress()) { return;