update.... 2 hie 4 commit message

This commit is contained in:
Dionysus 2024-06-05 23:23:18 -04:00
parent e697bf6790
commit 847963c2ab
Signed by: acidvegas
GPG Key ID: EF4B922DB85DC9DE
3 changed files with 44 additions and 12 deletions

View File

@ -77,9 +77,11 @@ void playRTTTL(const char* rtttl) {
void playNotificationSound() {
playTone(1000, 200);
playTone(1000, 150);
delay(100);
playTone(1500, 200);
playTone(1500, 150);
delay(100);
playTone(2000, 200);
playTone(2000, 150);
delay(100);
playTone(500, 150);
}

View File

@ -6,13 +6,11 @@ SX1262 radio = new Module(RADIO_CS_PIN, RADIO_DIO1_PIN, RADIO_RST_PIN, RADIO_BUS
bool setupRadio() {
digitalWrite(BOARD_SDCARD_CS, HIGH);
pinMode(RADIO_CS_PIN, OUTPUT);
digitalWrite(RADIO_CS_PIN, HIGH);
digitalWrite(BOARD_TFT_CS, HIGH);
SPI.end();
SPI.begin(BOARD_SPI_SCK, BOARD_SPI_MISO, BOARD_SPI_MOSI); //SD
int state = radio.begin(RADIO_FREQ);
if (state == RADIOLIB_ERR_NONE) {
Serial.println("Start Radio success!");
} else {
@ -73,4 +71,32 @@ bool setupRadio() {
//radio.setDio1Action(setFlag);
return true;
}
bool transmit() {
int state = radio.transmit("Hello World!");
// you can also transmit byte array up to 256 bytes long
/*
byte byteArr[] = {0x01, 0x23, 0x45, 0x56, 0x78, 0xAB, 0xCD, 0xEF};
int state = radio.transmit(byteArr, 8);
*/
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("Radio tramsmittion successful!"));
Serial.print(F("[SX1262] Datarate:\t"));
Serial.print(radio.getDataRate());
Serial.println(F(" bps"));
return true;
} else if (state == RADIOLIB_ERR_PACKET_TOO_LONG) {
Serial.println(F("Radio packet too long")); // 256 bytes is the maximum packet length
return false;
} else if (state == RADIOLIB_ERR_TX_TIMEOUT) {
Serial.println(F("Radio timeout"));
return false;
} else {
Serial.print(F("Radio error failed, code "));
Serial.println(state);
return false;
}
}

View File

@ -125,22 +125,26 @@ void wgConnect(const IPAddress& localIp, const char* privateKey, const char* end
void setup() {
// Initialize serial communication
Serial.begin(115200);
// Wait for the serial monitor to open
//while (!Serial);
Serial.println("Booting device...");
// Turn on the power to the board
// Give power to the board peripherals
pinMode(BOARD_POWERON, OUTPUT);
digitalWrite(BOARD_POWERON, HIGH);
// Turn on power to the screen
// Give power to the screen
pinMode(TFT_BL, OUTPUT);
digitalWrite(TFT_BL, HIGH);
setBrightness(8); // Set the screen brightness to 50%
setBrightness(8); // Set the screen brightness to 50%)
// Give power to the SD card
pinMode(BOARD_SDCARD_CS, OUTPUT);
digitalWrite(BOARD_SDCARD_CS, HIGH);
pinMode(BOARD_SPI_MISO, INPUT_PULLUP);
SPI.begin(BOARD_SPI_SCK, BOARD_SPI_MISO, BOARD_SPI_MOSI); //SD
SPI.begin(BOARD_SPI_SCK, BOARD_SPI_MISO, BOARD_SPI_MOSI);
// Turn on power to the radio
pinMode(RADIO_CS_PIN, OUTPUT);
@ -163,7 +167,7 @@ void setup() {
// Initialize the speaker
setupI2S(); // Do we want to keep this open or uninstall after each use to keep resources free?
const char* rtttl_boot = "TakeOnMe:d=4,o=4,b=450:8f#5,8f#5,8f#5,8d5,8p,8b,8p,8e5,8p,8e5,8p,8e5,8g#5,8g#5,8a5,8b5,8a5,8a5,8a5,8e5,8p,8d5,8p,8f#5,8p,8f#5,8p,8f#5,8e5,8e5,8f#5,8e5,8f#5,8f#5,8f#5,8d5,8p,8b,8p,8e5,8p,8e5,8p,8e5,8g#5,8g#5,8a5,8b5,8a5,8a5,8a5,8e5,8p,8d5,8p,8f#5,8p,8f#5,8p,8f#5,8e5,8e5";
const char* rtttl_boot = "TakeOnMe:d=4,o=4,b=500:8f#5,8f#5,8f#5,8d5,8p,8b,8p,8e5,8p,8e5,8p,8e5,8g#5,8g#5,8a5,8b5,8a5,8a5,8a5,8e5,8p,8d5,8p,8f#5,8p,8f#5,8p,8f#5,8e5,8e5,8f#5,8e5,8f#5,8f#5,8f#5,8d5,8p,8b,8p,8e5,8p,8e5,8p,8e5,8g#5,8g#5,8a5,8b5,8a5,8a5,8a5,8e5,8p,8d5,8p,8f#5,8p,8f#5,8p,8f#5,8e5,8e5";
playRTTTL(rtttl_boot);
// Setup the WiFi