buzzer support has been added

pull/22/head
SQ5WPR 2021-03-17 23:24:37 +01:00
parent 6bf7c87f2c
commit b14273b1b6
2 changed files with 34 additions and 2 deletions

View File

@ -261,7 +261,28 @@ void prepareAPRSFrame(){
#endif #endif
} }
#ifdef BUZZER
/**
* Buzzer sound playback
* @param melody - must be an array. Consisting of an even number of values. frequency and duration
* @param array_size - number of elements in the array
*/
void buzzer(int* melody, int array_size){
for(int i=0; i<array_size; i+=2){
ledcWriteTone(0, *melody);
melody++;
delay(*melody);
melody++;
}
ledcWriteTone(0,0); // turn off buzzer
}
#endif
void sendpacket(){ void sendpacket(){
#ifdef BUZZER
int melody[] = {1000, 50, 800, 100};
buzzer(melody, sizeof(melody)/sizeof(int));
#endif
batt_read(); batt_read();
prepareAPRSFrame(); prepareAPRSFrame();
loraSend(txPower, TXFREQ, outString); //send the packet, data is in TXbuff from lora_TXStart to lora_TXEnd loraSend(txPower, TXFREQ, outString); //send the packet, data is in TXbuff from lora_TXStart to lora_TXEnd
@ -417,6 +438,12 @@ void sendTelemetryFrame() {
// + SETUP --------------------------------------------------------------+// // + SETUP --------------------------------------------------------------+//
void setup(){ void setup(){
#ifdef BUZZER
ledcSetup(0,1E5,12);
ledcAttachPin(BUZZER,0);
ledcWriteTone(0,0); // turn off buzzer on start
#endif
#ifdef DIGI_PATH #ifdef DIGI_PATH
relay_path = DIGI_PATH; relay_path = DIGI_PATH;
#else #else
@ -761,6 +788,10 @@ void loop() {
axp.setChgLEDMode(AXP20X_LED_LOW_LEVEL); axp.setChgLEDMode(AXP20X_LED_LOW_LEVEL);
#endif #endif
#endif #endif
#ifdef BUZZER
int melody[] = {300, 50, 500, 100};
buzzer(melody, sizeof(melody)/sizeof(int));
#endif
#ifdef SHOW_RX_PACKET // only show RX packets when activitated in config #ifdef SHOW_RX_PACKET // only show RX packets when activitated in config
loraReceivedLength = sizeof(lora_RXBUFF); // reset max length before receiving! loraReceivedLength = sizeof(lora_RXBUFF); // reset max length before receiving!
if (rf95.recvAPRS(lora_RXBUFF, &loraReceivedLength)) { if (rf95.recvAPRS(lora_RXBUFF, &loraReceivedLength)) {

View File

@ -7,7 +7,7 @@
// USER DATA - USE THESE LINES TO MODIFY YOUR PREFERENCES // USER DATA - USE THESE LINES TO MODIFY YOUR PREFERENCES
#define KISS_PROTOCOL // If enabled send and receive data in SIMPLE KISS format to serial, bluetooth and tcp port #define KISS_PROTOCOL // If enabled send and receive data in SIMPLE KISS format to serial, bluetooth and tcp port
#define CALLSIGN "NOCALL-0" // this option is available via WWW // enter your callsign here - less then 6 letter callsigns please add "spaces" so total length is 6 (without SSID) #define CALLSIGN "SQ5WPR-11" // this option is available via WWW // enter your callsign here - less then 6 letter callsigns please add "spaces" so total length is 6 (without SSID)
#define DIGI_PATH "ECHO" // this option is available via WWW // one hope, please use simple ECHO alias #define DIGI_PATH "ECHO" // this option is available via WWW // one hope, please use simple ECHO alias
#define FIXED_BEACON_EN // this option is available via WWW // allows cyclic sending of a bicon when GPS is turned off #define FIXED_BEACON_EN // this option is available via WWW // allows cyclic sending of a bicon when GPS is turned off
#define LATIDUDE_PRESET "0000.00N" // this option is available via WWW // please in APRS notation: DDMM.mmN or DDMM.mmS (used for manual or fixed beacon sending) #define LATIDUDE_PRESET "0000.00N" // this option is available via WWW // please in APRS notation: DDMM.mmN or DDMM.mmS (used for manual or fixed beacon sending)
@ -24,13 +24,14 @@
#define ENABLE_OLED // this option is available via WWW // enable oled #define ENABLE_OLED // this option is available via WWW // enable oled
#define ENABLE_LED_SIGNALING // enable red and blue led signalling #define ENABLE_LED_SIGNALING // enable red and blue led signalling
//#define ENABLE_TNC_SELF_TELEMETRY // //#define ENABLE_TNC_SELF_TELEMETRY //
//#define LOCAL_KISS_ECHO // echoing KISS frame back // #define LOCAL_KISS_ECHO // echoing KISS frame back
//#define KISS_DEBUG // //#define KISS_DEBUG //
#define NETWORK_TNC_PORT 8001 // Set KISS TCP Port #define NETWORK_TNC_PORT 8001 // Set KISS TCP Port
//#define ENABLE_WIFI_CLIENT_DEBUG // //#define ENABLE_WIFI_CLIENT_DEBUG //
#define MAX_TIME_TO_NEXT_TX 360000L // TRANSMIT INTERVAL set here MAXIMUM time in ms(!) for smart beaconing - minimum time is always 1 min = 60 secs = 60000L !!! #define MAX_TIME_TO_NEXT_TX 360000L // TRANSMIT INTERVAL set here MAXIMUM time in ms(!) for smart beaconing - minimum time is always 1 min = 60 secs = 60000L !!!
#define FIX_BEACON_INTERVAL 1800000L // Fixed beacon interwal (when GPS is disabled and FIXED_BEACON_EN is enabled) 30min default #define FIX_BEACON_INTERVAL 1800000L // Fixed beacon interwal (when GPS is disabled and FIXED_BEACON_EN is enabled) 30min default
//#define TNC_SELF_TELEMETRY_INTERVAL (5 * 60 * 1000) // //#define TNC_SELF_TELEMETRY_INTERVAL (5 * 60 * 1000) //
#define BUZZER 15 // enter your buzzer pin gpio
#ifdef T_BEAM_V1_0 #ifdef T_BEAM_V1_0
#define ENABLE_WIFI // enable WiFi conection do not turn off #define ENABLE_WIFI // enable WiFi conection do not turn off