Added setKeyerSpeed function

pull/10/head
g7uhn 2020-10-18 22:08:16 +01:00
rodzic b0e3d0bbb7
commit 78500e30de
3 zmienionych plików z 43 dodań i 13 usunięć

Wyświetl plik

@ -265,6 +265,35 @@ 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
Serial.print("Requested speed = ");
Serial.println(speed);
Serial.print("Constrained speed = ");
Serial.println(wpm);
byte keyerSpeedSetting = wpm - 4;
Serial.print("Keyer speed setting (before bitwise op)= ");
Serial.println(keyerSpeedSetting);
Serial.print("Keyer speed setting (binary)= ");
Serial.println(keyerSpeedSetting, BIN);
MSB = 0x00; // set the address to write to
LSB = 0x62;
readEEPROM();
Serial.print("actualByte received = ");
Serial.println(actualByte, BIN);
if (eepromValidData)
{
byte bitsAbove = 0b11000000 & actualByte; // bits 6 and 7 from byte 0x62 must be kept (= Battery Charge Time)
Serial.print("bits above = ");
Serial.println(bitsAbove, BIN);
keyerSpeedSetting = bitsAbove | keyerSpeedSetting;
Serial.print("Keyer speed setting (after bitwise op)= ");
Serial.println(keyerSpeedSetting, BIN);
writeEEPROM(keyerSpeedSetting);
}
}
/****** GET COMMANDS ********/
@ -386,7 +415,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;

Wyświetl plik

@ -358,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

@ -114,21 +114,21 @@ String page1SoftkeyLabel2 = "A/B"; // 3 characters
void page1SoftkeyFunction2() {radio.toggleVFO();}
boolean page1SoftkeyStatus2() {}
// SOFT-KEY 3
String page1SoftkeyLabel3 = "NAR"; // 3 characters
void page1SoftkeyFunction3() {radio.toggleNar();}
boolean page1SoftkeyStatus3() {return radio.getNar();}
String page1SoftkeyLabel3 = " "; // 3 characters
void page1SoftkeyFunction3() {}
boolean page1SoftkeyStatus3() {}
// SOFT-KEY 4
String page1SoftkeyLabel4 = " NAR"; // 6 characters
void page1SoftkeyFunction4() {radio.toggleNar();}
boolean page1SoftkeyStatus4() {return radio.getNar();}
String page1SoftkeyLabel4 = " k12"; // 6 characters
void page1SoftkeyFunction4() {radio.setKeyerSpeed(12);}
boolean page1SoftkeyStatus4() {}
// SOFT-KEY 5
String page1SoftkeyLabel5 = "NAR"; // 3 characters
void page1SoftkeyFunction5() {radio.toggleNar();}
boolean page1SoftkeyStatus5() {return radio.getNar();}
String page1SoftkeyLabel5 = "k15"; // 3 characters
void page1SoftkeyFunction5() {radio.setKeyerSpeed(15);}
boolean page1SoftkeyStatus5() {}
// SOFT-KEY 6
String page1SoftkeyLabel6 = "NAR"; // 3 characters
void page1SoftkeyFunction6() {radio.toggleNar();}
boolean page1SoftkeyStatus6() {return radio.getNar();}
String page1SoftkeyLabel6 = "k18"; // 3 characters
void page1SoftkeyFunction6() {radio.setKeyerSpeed(18);}
boolean page1SoftkeyStatus6() {}
void setup(void)