Merge pull request #11 from g7uhn/development

Merge Development into Master
pull/12/head
Andy Webster 2020-11-08 22:12:11 +00:00 zatwierdzone przez GitHub
commit ac179b7f26
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
4 zmienionych plików z 460 dodań i 238 usunięć

Wyświetl plik

@ -25,11 +25,14 @@ This allow us to be consistent and save a few bytes of firmware
*/
#include <Arduino.h>
#include <SoftwareSerial.h>
// #include <SoftwareSerial.h>
#include "ft817.h"
// define software serial IO pins here:
extern SoftwareSerial rigCat(12, 11); // rx,tx
// if using software serial, define software serial IO pins here:
// extern SoftwareSerial rigCat(12, 11); // rx,tx
// if using hardware serial, define hardware serial alias here:
#define rigCat Serial
#define dlyTime 5 // delay (in ms) after serial writes
@ -40,13 +43,13 @@ FT817::FT817(){ } // nothing to do when first instanced
// Setup software serial with user defined input
// from the Arduino sketch (function, though very slow)
void FT817::setSerial(SoftwareSerial portInfo)
{
rigCat = portInfo;
}
// void FT817::setSerial(SoftwareSerial portInfo)
// {
// rigCat = portInfo;
// }
// similar to Serial.begin(baud); command
void FT817::begin(int baud)
void FT817::begin(long baud)
{
rigCat.begin(baud);
}
@ -148,6 +151,15 @@ bool FT817::toggleKeyer()
return toggleBitFromEEPROM(4);
}
// Toggle the RF Gain / Squelch control
// Set by bit 7 of EEPROM byte 5F
bool FT817::toggleRfSql()
{
MSB = 0x00;
LSB = 0x5F;
return toggleBitFromEEPROM(7);
}
/****** SET COMMANDS ********/
// set radio frequency directly (as a long integer)
@ -256,6 +268,21 @@ void FT817::squelchFreq(unsigned int freq, char * sqlType)
getByte();
}
void FT817::setKeyerSpeed(int speed)
{
byte wpm = constrain(speed, 4, 60); // Constrain input between FT-817 min and max keyer speed
byte keyerSpeedSetting = wpm - 4;
MSB = 0x00; // set the address to write to
LSB = 0x62;
readEEPROM();
if (eepromValidData)
{
byte bitsAbove = 0b11000000 & actualByte; // bits 6 and 7 from byte 0x62 must be kept (= Battery Charge Time)
keyerSpeedSetting = bitsAbove | keyerSpeedSetting;
writeEEPROM(keyerSpeedSetting);
}
}
/****** GET COMMANDS ********/
@ -377,7 +404,7 @@ bool FT817::getBreakIn()
return getBitFromEEPROM(5);
}
// get BrakIn status from bit 4 in EEPROM address 0x58
// get Keyer status from bit 4 in EEPROM address 0x58
bool FT817::getKeyer()
{
MSB = 0x00;
@ -473,7 +500,7 @@ bool FT817::readEEPROM()
nextByte = buffer[1];
}
delay(50); // mandatory delay
delay(20); // mandatory delay
}
return eepromValidData;

Wyświetl plik

@ -332,8 +332,8 @@ class FT817
public:
FT817();
// setup
void setSerial(SoftwareSerial portInfo); // load the softserial into the FT817
void begin(int baud); // set the baudrate of the softserial lib
// void setSerial(SoftwareSerial portInfo); // load the softserial into the FT817
void begin(long baud); // set the baudrate of the serial lib
// toggles
void lock(boolean toggle); // lock/unlock
@ -347,6 +347,7 @@ class FT817
// breifly to the other VFO and back, returns true is success
bool toggleBreakIn(); // toggle BreakIn
bool toggleKeyer(); // toggle Keyer status
bool toggleRfSql(); // toggle RF Gain/SQL control
// set commands
void setFreq(long freq); // in 10' of hz
@ -357,6 +358,7 @@ class FT817
void rptrOffsetFreq(long freq);
void squelch(char * mode);
void squelchFreq(unsigned int, char * sqlType);
void setKeyerSpeed(int speed);
// get commands
bool getVFO(); // return the actual VFO: 0 = A / 1 = B

Wyświetl plik

@ -8,11 +8,14 @@
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:nanoatmega328new]
[env:pro16MHzatmega328]
// [env:nanoatmega328new]
platform = atmelavr
board = nanoatmega328new
board = pro16MHzatmega328
// board = nanoatmega328new
framework = arduino
lib_deps =
adafruit/Adafruit GFX Library @ ^1.10.1
adafruit/Adafruit PCD8544 Nokia 5110 LCD library @ ^1.2.0
adafruit/Adafruit BusIO @ ^1.5.0
slashdevin/NeoSWSerial@^3.0.5

Wyświetl plik

@ -34,16 +34,17 @@
// Declarations
Adafruit_PCD8544 display = Adafruit_PCD8544(7, 6, 5, 4, 3); // pins for (CLK,DIN,D/C,CE,RST)
FT817 radio; // define “radio” so that we may pass CAT and EEPROM commands
FT817 radio; // define “radio” so that we may pass CAT and EEPROM commands
// Define PCB pins
int buttonPin = A0; // SW1-SW6 arrive as different levels on analog input A0
int sw7 = 5; // SW7 input is D5
int sw8 = 10; // SW8 input is D10
int sw9 = 9; // SW9 input is D9
int backlight = 8; // backlight output pin (not the "LIGHT" input button!)
int backlightPin = 8; // backlight output pin (not the "LIGHT" input button!)
int buttonPin = A0; // SW1-SW6 arrive as different levels on analog input A0
int sw7pin = 2; // SW7 input is D2
int sw8pin = 10; // SW8 input is D10
int sw9pin = 9; // SW9 input is D9
// Global variables - g7uhn TO DO: Needs a big tidy up here
bool sw7status = 1; // using pullup, pressing button takes this low
bool sw8status = 1; // using pullup, pressing button takes this low
bool sw9status = 1; // using pullup, pressing button takes this low
long freq;
@ -51,37 +52,96 @@ String mode;
byte modeByte;
byte modeBase; // used for the radio to return to this mode after generating Tune signal... needed to accomodate the CW/CWR/DIG NAR codes
byte modeReturn;
int buttonStatus = 0;
int button = 0;
boolean splitState = false;
byte abcKeys = B1111;
int buttonStatus = 0; // analog value of buttonPin...
int button = 0; // ...button number
byte sMeter;
byte currentBand;
int currentVfo;
byte MSB;
byte LSB;
byte returnedByte;
// New variables for soft-key pages and soft-key status
int currentPage = 1; // initialise at the last page
bool softkeyStatus[6] = {0, 0, 0, 0, 0, 0};
//Forward declaration of functions (required for PlatformIO)
// Forward declaration of functions (required for PlatformIO)
// If you create your own user functions below, you'll need to declare them here for PlatformIO to compile
void displayABCkeys();
void getReadableMode();
void backlight();
void changePage();
void tuneSignalOn();
void tuneSignalOff();
void toggleNar();
void toggleIpo();
void toggleBreakIn();
void toggleKeyer();
unsigned char ToByte(bool b[8]); // debug aid, to be removed when unused
// SETUP SOFT-KEY PAGES
// Single functions from the ft817 library can be called straight from the pageXSoftKeyFunctionY function above
// or, if the desired function is a combination of actions, define a function in the USER FUNCTIONS section below
// to be called by the sketch. Don't forget to forward declare your user function above.
// Page0 items
// SOFT-KEY 1
String page0SoftkeyLabel1 = "TUNon "; // 6 characters
void page0SoftkeyFunction1() {tuneSignalOn();}
boolean page0SoftkeyStatus1() {}
// SOFT-KEY 2
String page0SoftkeyLabel2 = "IPO"; // 3 characters
void page0SoftkeyFunction2() {radio.toggleIPO();}
boolean page0SoftkeyStatus2() {return radio.getIPO();}
// SOFT-KEY 3
String page0SoftkeyLabel3 = "KYR"; // 3 characters
void page0SoftkeyFunction3() {radio.toggleKeyer();}
boolean page0SoftkeyStatus3() {return radio.getKeyer();}
// SOFT-KEY 4
String page0SoftkeyLabel4 = "TUNoff"; // 6 characters
void page0SoftkeyFunction4() {tuneSignalOff();}
boolean page0SoftkeyStatus4() {}
// SOFT-KEY 5
String page0SoftkeyLabel5 = " BK"; // 3 characters
void page0SoftkeyFunction5() {radio.toggleBreakIn();}
boolean page0SoftkeyStatus5() {return radio.getBreakIn();}
// SOFT-KEY 6
String page0SoftkeyLabel6 = "NAR"; // 3 characters
void page0SoftkeyFunction6() {radio.toggleNar();}
boolean page0SoftkeyStatus6() {return radio.getNar();}
// Page1 items
// SOFT-KEY 1
String page1SoftkeyLabel1 = "RF/SQL"; // 6 characters
void page1SoftkeyFunction1() {radio.toggleRfSql();}
boolean page1SoftkeyStatus1() {}
// SOFT-KEY 2
String page1SoftkeyLabel2 = "A/B"; // 3 characters
void page1SoftkeyFunction2() {radio.toggleVFO();}
boolean page1SoftkeyStatus2() {}
// SOFT-KEY 3
String page1SoftkeyLabel3 = " "; // 3 characters
void page1SoftkeyFunction3() {}
boolean page1SoftkeyStatus3() {}
// SOFT-KEY 4
String page1SoftkeyLabel4 = " k12"; // 6 characters
void page1SoftkeyFunction4() {radio.setKeyerSpeed(12);}
boolean page1SoftkeyStatus4() {}
// SOFT-KEY 5
String page1SoftkeyLabel5 = "k15"; // 3 characters
void page1SoftkeyFunction5() {radio.setKeyerSpeed(15);}
boolean page1SoftkeyStatus5() {}
// SOFT-KEY 6
String page1SoftkeyLabel6 = "k18"; // 3 characters
void page1SoftkeyFunction6() {radio.setKeyerSpeed(18);}
boolean page1SoftkeyStatus6() {}
void setup(void)
{
// Start serial
Serial.begin(9600); // serial port for the main sketch to talk to radio... is this necessary after the refactor?
radio.begin(9600); // start the serial port for the CAT library
// Serial.begin(9600); // serial port for the main sketch to talk to PC serial monitor
radio.begin(38400); // start the serial port for the CAT library
// Set up some pins
pinMode(backlight, OUTPUT);
pinMode(sw7, INPUT_PULLUP);
pinMode(sw8, INPUT_PULLUP);
pinMode(sw9, INPUT_PULLUP);
pinMode(backlightPin, OUTPUT);
pinMode(sw7pin, INPUT_PULLUP);
pinMode(sw8pin, INPUT_PULLUP);
pinMode(sw9pin, INPUT_PULLUP);
// Initialize Display
display.begin();
@ -101,44 +161,20 @@ void setup(void)
sei(); // allow interrupts
// Initial display setup
display.drawFastVLine(40, 0, 10, BLACK);
display.drawFastVLine(21, 10, 21, BLACK);
display.drawFastVLine(62, 10, 21, BLACK);
display.drawFastVLine(41, 0, 10, BLACK);
display.drawFastVLine(24, 10, 21, BLACK);
display.drawFastVLine(59, 10, 21, BLACK);
display.drawFastHLine(0, 9, display.width(), BLACK);
display.drawFastHLine(0, 20, 21, BLACK);
display.drawFastHLine(62, 20, 21, BLACK);
display.drawFastHLine(0, 30, 21, BLACK);
display.drawFastHLine(62, 30, 21, BLACK);
display.drawFastHLine(0, 20, 24, BLACK);
display.drawFastHLine(60, 20, 24, BLACK);
display.drawFastHLine(0, 30, 24, BLACK);
display.drawFastHLine(60, 30, 24, BLACK);
// Display the FT-817 soft-keys (A,B,C) g7uhn TO DO: move this into a periodic check of radio status along with SW1-6 status indications
displayABCkeys();
// Display the FT-817 A,B,C keys g7uhn TO DO: move this into a periodic check of radio status along with SW1-6 status indications
//displayABCkeys();
// Label the soft keys
// may update this when I implement multiple pages of soft-keys...
//Button 1
display.setCursor(0, 0);
display.setTextSize(1);
display.print("TUNon");
//Button 2
display.setCursor(0, 11);
display.setTextSize(1);
display.print("IPO");
//Button 3
display.setCursor(0, 22);
display.setTextSize(1);
display.print("KYR");
//Button 4
display.setCursor(48, 0);
display.setTextSize(1);
display.print("TUNoff");
//Button 5
display.setCursor(66, 11);
display.setTextSize(1);
display.print(" BK");
//Button 6
display.setCursor(66, 22);
display.setTextSize(1);
display.print("NAR");
// Display the soft keys by calling changePage()
changePage();
// write to display
display.display();
@ -146,95 +182,204 @@ void setup(void)
} // end setup
void loop()
void loop() // MAIN LOOP
{
// Very rough backlight function (blocking) g7uhn TO DO: make a better (non-blocking) backlight
sw8status = digitalRead(sw8);
if (sw8status == LOW)
// Using two loops to avoid polling the radio too quickly with things we don't need a fast refresh on:
// 1) a "fast refresh" loop is run within the main loop for status items that we do want a quick refresh rate e.g. frequency and mode display
// 2) actions we only need a "slow refresh" are performed outside of the fast loop in the main loop e.g. status bits against soft-key labels
// FAST REFRESH LOOP starts here
for (int i = 0; i <=3; i++)
{
digitalWrite(backlight, 1);
delay(5000); // Backlight on for 5s
digitalWrite(backlight, 0);
// Get frequency
freq = radio.getFreqMode(); //freq is a long integer of 10's of Hz
int MHz = freq / 100000;
long remainder = freq % 100000;
float kHz = remainder / 100.00;
// Get human readable mode data
getReadableMode();
// // Get Receiver status (S-meter)
// byte rxStatusCmd[5] = {0x00, 0x00, 0x00, 0x00, 0xe7};
// radioCAT.sendCmd(rxStatusCmd, 5);
// sMeter = radioCAT.getByte();
// sMeter = sMeter << 4; //left shift the bits by 4 to make this an S-meter byte ranging from 00000000 to 11110000
if (currentPage == 0)
{
if (button == 0) {}
else if (button == 1) { page0SoftkeyFunction1(); }
else if (button == 2) { page0SoftkeyFunction2(); }
else if (button == 3) { page0SoftkeyFunction3(); }
else if (button == 4) { page0SoftkeyFunction4(); }
else if (button == 5) { page0SoftkeyFunction5(); }
else if (button == 6) { page0SoftkeyFunction6(); }
button = 0; // reset button variable to zero once we've used it
}
else if (currentPage == 1)
{
if (button == 0) {}
else if (button == 1) { page1SoftkeyFunction1(); }
else if (button == 2) { page1SoftkeyFunction2(); }
else if (button == 3) { page1SoftkeyFunction3(); }
else if (button == 4) { page1SoftkeyFunction4(); }
else if (button == 5) { page1SoftkeyFunction5(); }
else if (button == 6) { page1SoftkeyFunction6(); }
button = 0; // reset button variable to zero once we've used it
}
// FAST REFRESH STATUS DISPLAY ITEMS
// Print dial frequency
display.setCursor(16, 32);
display.setTextSize(1);
display.setTextColor(BLACK, WHITE);
display.print(MHz);
display.print(",");
if (kHz < 100) display.print('0');
if (kHz < 10) display.print('0');
display.print(kHz);
if (MHz < 100) display.print(' ');
if (MHz < 10) display.print(' ');
display.print(' '); // extra character to print over the occasional stray "8"
// Print current mode
display.setCursor(27, 22);
display.setTextSize(1);
display.setTextColor(BLACK, WHITE);
display.print(mode);
//// Print S-meter
// tft.setCursor(50,120);
// int sMeterWidth = 5*(sMeter / 16);
// tft.drawRect(51,119,76,8,WHITE);
// tft.fillRect(52,120,sMeterWidth,6,WHITE);
// tft.fillRect((52+sMeterWidth),120,(74-sMeterWidth),6,BLACK);
delay(200);
// write to display
display.display();
} // END OF FAST REFRESH LOOP (performed 4 times in every main loop)
// SLOW REFRESH STUFF
if (sw7status == LOW) // PAGE button
{
changePage();
sw7status = HIGH; // reset sw7status to high once we've used it
}
// Get frequency
freq = radio.getFreqMode(); //freq is a long integer of 10's of Hz
int MHz = freq / 100000;
long remainder = freq % 100000;
float kHz = remainder / 100.00;
// Get human readable mode data
getReadableMode();
// // Get Receiver status (S-meter)
// byte rxStatusCmd[5] = {0x00, 0x00, 0x00, 0x00, 0xe7};
// radioCAT.sendCmd(rxStatusCmd, 5);
// sMeter = radioCAT.getByte();
// sMeter = sMeter << 4; //left shift the bits by 4 to make this an S-meter byte ranging from 00000000 to 11110000
if (button == 0) {
if (sw8status == LOW) // LIGHT button
{
backlight();
}
else if (button == 1) {
tuneSignalOn();
}
else if (button == 2) {
toggleIpo();
}
else if (button == 3) {
toggleKeyer();
}
else if (button == 4) {
tuneSignalOff();
}
else if (button == 5) {
toggleBreakIn();
}
else if (button == 6) {
toggleNar();
}
button = 0; // reset button variable to zero once we've used it
// STATUS DISPLAY ITEMS
// Update the soft-key status indicators
if (currentPage == 0)
{
softkeyStatus[0] = page0SoftkeyStatus1();
softkeyStatus[1] = page0SoftkeyStatus2();
softkeyStatus[2] = page0SoftkeyStatus3();
softkeyStatus[3] = page0SoftkeyStatus4();
softkeyStatus[4] = page0SoftkeyStatus5();
softkeyStatus[5] = page0SoftkeyStatus6();
}
else if (currentPage == 1)
{
softkeyStatus[0] = page1SoftkeyStatus1();
softkeyStatus[1] = page1SoftkeyStatus2();
softkeyStatus[2] = page1SoftkeyStatus3();
softkeyStatus[3] = page1SoftkeyStatus4();
softkeyStatus[4] = page1SoftkeyStatus5();
softkeyStatus[5] = page1SoftkeyStatus6();
}
// Print dial frequency
display.setCursor(16, 32);
display.setTextSize(1);
display.setTextColor(BLACK, WHITE);
display.print(MHz);
display.print(",");
if (kHz < 100) display.print('0');
if (kHz < 10) display.print('0');
display.print(kHz);
if (MHz < 100) display.print(' ');
if (MHz < 10) display.print(' ');
display.print(' '); // extra character to print over the occasional stray "8"
// Display the soft-key status indicators
if (softkeyStatus[0])
{
display.drawFastVLine(0, 0, 9, BLACK);
display.drawFastVLine(1, 0, 9, BLACK);
display.drawFastVLine(2, 0, 9, BLACK);
}
else
{
display.drawFastVLine(0, 0, 9, WHITE);
display.drawFastVLine(1, 0, 9, WHITE);
display.drawFastVLine(2, 0, 9, WHITE);
}
if (softkeyStatus[1])
{
display.drawFastVLine(0, 10, 10, BLACK);
display.drawFastVLine(1, 10, 10, BLACK);
display.drawFastVLine(2, 10, 10, BLACK);
}
else
{
display.drawFastVLine(0, 10, 10, WHITE);
display.drawFastVLine(1, 10, 10, WHITE);
display.drawFastVLine(2, 10, 10, WHITE);
}
if (softkeyStatus[2])
{
display.drawFastVLine(0, 21, 9, BLACK);
display.drawFastVLine(1, 21, 9, BLACK);
display.drawFastVLine(2, 21, 9, BLACK);
}
else
{
display.drawFastVLine(0, 21, 9, WHITE);
display.drawFastVLine(1, 21, 9, WHITE);
display.drawFastVLine(2, 21, 9, WHITE);
}
if (softkeyStatus[3])
{
display.drawFastVLine(83, 0, 9, BLACK);
display.drawFastVLine(82, 0, 9, BLACK);
display.drawFastVLine(81, 0, 9, BLACK);
}
else
{
display.drawFastVLine(83, 0, 9, WHITE);
display.drawFastVLine(82, 0, 9, WHITE);
display.drawFastVLine(81, 0, 9, WHITE);
}
if (softkeyStatus[4])
{
display.drawFastVLine(83, 10, 10, BLACK);
display.drawFastVLine(82, 10, 10, BLACK);
display.drawFastVLine(81, 10, 10, BLACK);
}
else
{
display.drawFastVLine(83, 10, 10, WHITE);
display.drawFastVLine(82, 10, 10, WHITE);
display.drawFastVLine(81, 10, 10, WHITE);
}
if (softkeyStatus[5])
{
display.drawFastVLine(83, 21, 9, BLACK);
display.drawFastVLine(82, 21, 9, BLACK);
display.drawFastVLine(81, 21, 9, BLACK);
}
else
{
display.drawFastVLine(83, 21, 9, WHITE);
display.drawFastVLine(82, 21, 9, WHITE);
display.drawFastVLine(81, 21, 9, WHITE);
}
// Print current mode
display.setCursor(25, 22);
display.setTextSize(1);
display.setTextColor(BLACK, WHITE);
display.print(mode);
// Update the ABC keys
displayABCkeys();
//// Print S-meter
// tft.setCursor(50,120);
// int sMeterWidth = 5*(sMeter / 16);
// tft.drawRect(51,119,76,8,WHITE);
// tft.fillRect(52,120,sMeterWidth,6,WHITE);
// tft.fillRect((52+sMeterWidth),120,(74-sMeterWidth),6,BLACK);
display.display(); // update display
delay(200);
// write to display
display.display();
} // end of main loop
} // END OF MAIN LOOP
// Interrupt code
// Interrupt code reading buttons at 50Hz
ISR(TIMER1_COMPA_vect)
{ //change the 0 to 1 for timer1 and 2 for timer2
// Get button status (levels determined by resistor network)
@ -257,16 +402,88 @@ ISR(TIMER1_COMPA_vect)
else if (buttonStatus < 900) {
button = 6;
}
bool sw7 = digitalRead(sw7pin);
if (!sw7)
{
sw7status = LOW;
}
sw8status = digitalRead(sw8pin);
sw9status = digitalRead(sw9pin);
}
// Cycle through soft-key pages
void changePage()
{
currentPage = ++currentPage % 2; // 2 pages
// Label the soft keys
// may update this when I implement multiple pages of soft-keys...
if (currentPage == 0)
{
display.setTextSize(1);
//Button 1
display.setCursor(5, 0);
display.print(page0SoftkeyLabel1);
//Button 2
display.setCursor(5, 11);
display.print(page0SoftkeyLabel2);
//Button 3
display.setCursor(5, 22);
display.print(page0SoftkeyLabel3);
//Button 4
display.setCursor(44, 0);
display.print(page0SoftkeyLabel4);
//Button 5
display.setCursor(62, 11);
display.print(page0SoftkeyLabel5);
//Button 6
display.setCursor(62, 22);
display.print(page0SoftkeyLabel6);
}
else if (currentPage ==1)
{
display.setTextSize(1);
//Button 1
display.setCursor(5, 0);
display.print(page1SoftkeyLabel1);
//Button 2
display.setCursor(5, 11);
display.print(page1SoftkeyLabel2);
//Button 3
display.setCursor(5, 22);
display.print(page1SoftkeyLabel3);
//Button 4
display.setCursor(44, 0);
display.print(page1SoftkeyLabel4);
//Button 5
display.setCursor(62, 11);
display.print(page1SoftkeyLabel5);
//Button 6
display.setCursor(62, 22);
display.print(page1SoftkeyLabel6);
}
}
// Very rough backlight function (blocking) g7uhn TO DO: make a better (non-blocking) backlight
void backlight()
{
digitalWrite(backlightPin, 1);
delay(5000); // Backlight on for 5s
digitalWrite(backlightPin, 0);
}
// USER FUNCTIONS
// Single functions from the ft817 library can be called straight from the pageXSoftKeyFunctionY function above
// or, if the desired function is a combination of actions, define a function below to be called by the sketch.
void tuneSignalOn()
{
sw9status = digitalRead(sw9);
sw9status = digitalRead(sw9pin);
if (sw9status == LOW) // is SHIFT key held down? (safety measure)
{
// Store current operating base mode i.e. ignoring the NAR mode codes
@ -290,85 +507,57 @@ void tuneSignalOff()
}
void toggleVfo()
{
radio.toggleVFO();
}
void toggleNar()
{
radio.toggleNar();
}
void toggleIpo()
{
radio.toggleIPO();
}
void toggleBreakIn()
{
radio.toggleBreakIn();
}
void toggleKeyer()
{
radio.toggleKeyer();
}
void displayABCkeys()
{
byte abcKeys = radio.getDisplaySelection();
// Print current soft-keys (A B C)
display.setCursor(0, 41);
display.setTextSize(1);
display.setTextColor(BLACK, WHITE);
switch (abcKeys) {
case B0000:
display.print(" A/B A=B SPL");
break;
case B0001:
display.print(" MW MC TAG");
break;
case B0010:
display.print(" STO RCL PMS");
break;
case B0011:
display.print(" RPT REV TON");
break;
case B0100:
display.print(" SCN PRI DW ");
break;
case B0101:
display.print(" SSM SCH ART");
break;
case B0110:
display.print(" IPO ATT NAR");
break;
case B0111:
display.print(" NB AGC ");
break;
case B1000:
display.print(" PWR MTR ");
break;
case B1001:
display.print(" VOX BK KYR");
break;
case B1010:
display.print(" CHG VLT DSP");
break;
case B1011:
display.print(" TCH DCH ");
break;
byte currentAbcKeys = radio.getDisplaySelection();
if (currentAbcKeys != abcKeys)
{
abcKeys = currentAbcKeys;
// Print current ABC keys
display.setCursor(0, 41);
display.setTextSize(1);
display.setTextColor(BLACK, WHITE);
switch (abcKeys) {
case B0000:
display.print(" A/B A=B SPL");
break;
case B0001:
display.print(" MW MC TAG");
break;
case B0010:
display.print(" STO RCL PMS");
break;
case B0011:
display.print(" RPT REV TON");
break;
case B0100:
display.print(" SCN PRI DW ");
break;
case B0101:
display.print(" SSM SCH ART");
break;
case B0110:
display.print(" IPO ATT NAR");
break;
case B0111:
display.print(" NB AGC ");
break;
case B1000:
display.print(" PWR MTR ");
break;
case B1001:
display.print(" VOX BK KYR");
break;
case B1010:
display.print(" CHG VLT DSP");
break;
case B1011:
display.print(" TCH DCH ");
break;
}
}
}
@ -378,58 +567,59 @@ void displayABCkeys()
void getReadableMode() {
modeByte = radio.getMode();
if (modeByte == 0x00) {
mode = "LSB ";
mode = "LSB ";
modeBase = modeByte;
}
else if (modeByte == 0x01) {
mode = "USB ";
mode = "USB ";
modeBase = modeByte;
}
else if (modeByte == 0x02) {
mode = "CW ";
mode = "CW ";
modeBase = modeByte;
}
else if (modeByte == 0x03) {
mode = "CWR ";
mode = "CWR ";
modeBase = modeByte;
}
else if (modeByte == 0x82) {
mode = "CW NR ";
mode = "CW N ";
modeBase = 0x02;
}
else if (modeByte == 0x83) {
mode = "CWR NR";
mode = "CWR N";
modeBase = 0x03;
}
else if (modeByte == 0x8A) {
mode = "DIG NR";
mode = "DIG N";
modeBase = 0x0A;
}
else if (modeByte == 0x04) {
mode = "AM ";
mode = "AM ";
modeBase = modeByte;
}
else if (modeByte == 0x06) {
mode = "WFM ";
mode = "WFM ";
modeBase = modeByte;
}
else if (modeByte == 0x08) {
mode = "FM ";
mode = "FM ";
modeBase = modeByte;
}
else if (modeByte == 0x88) { // this one wasn't listed in the spec?
mode = "FM-N ";
mode = "FM-N ";
modeBase = modeByte;
}
else if (modeByte == 0x0A) {
mode = "DIG ";
mode = "DIG ";
modeBase = modeByte;
}
else if (modeByte == 0x0C) {
mode = "PKT ";
mode = "PKT ";
modeBase = modeByte;
}
else {
char mode[] = "??";
}
}