Merge pull request #8 from qiwenmin/master
Fixed most compilation warnings and a delay issue
This commit is contained in:
commit
2fe1662d67
@ -398,7 +398,7 @@ void ReadEEPRom_FT817(byte fromType)
|
|||||||
|
|
||||||
void WriteEEPRom_FT817(byte fromType)
|
void WriteEEPRom_FT817(byte fromType)
|
||||||
{
|
{
|
||||||
byte temp0 = CAT_BUFF[0];
|
//byte temp0 = CAT_BUFF[0];
|
||||||
byte temp1 = CAT_BUFF[1];
|
byte temp1 = CAT_BUFF[1];
|
||||||
|
|
||||||
CAT_BUFF[0] = 0;
|
CAT_BUFF[0] = 0;
|
||||||
|
@ -208,10 +208,14 @@ void sendCWChar(char cwKeyChar)
|
|||||||
charLength = ((tmpChar >> 6) & 0x03) + 3;
|
charLength = ((tmpChar >> 6) & 0x03) + 3;
|
||||||
|
|
||||||
for (j = 0; j < charLength; j++)
|
for (j = 0; j < charLength; j++)
|
||||||
sendBuff[j] = (tmpChar << j + 2) & 0x80;
|
sendBuff[j] = (tmpChar << (j + 2)) & 0x80;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
charLength = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,7 +261,7 @@ unsigned long scrollDispayTime = 0;
|
|||||||
#define scrollSpeed 500
|
#define scrollSpeed 500
|
||||||
byte displayScrolStep = 0;
|
byte displayScrolStep = 0;
|
||||||
|
|
||||||
int controlAutoCW(){
|
void controlAutoCW(){
|
||||||
int knob = 0;
|
int knob = 0;
|
||||||
byte i;
|
byte i;
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ unsigned long vfoA=7150000L, vfoB=14200000L, sideTone=800, usbCarrier;
|
|||||||
unsigned long vfoA_eeprom, vfoB_eeprom; //for protect eeprom life
|
unsigned long vfoA_eeprom, vfoB_eeprom; //for protect eeprom life
|
||||||
unsigned long frequency, ritRxFrequency, ritTxFrequency; //frequency is the current frequency on the dial
|
unsigned long frequency, ritRxFrequency, ritTxFrequency; //frequency is the current frequency on the dial
|
||||||
|
|
||||||
int cwSpeed = 100; //this is actuall the dot period in milliseconds
|
unsigned int cwSpeed = 100; //this is actuall the dot period in milliseconds
|
||||||
extern int32_t calibration;
|
extern int32_t calibration;
|
||||||
|
|
||||||
//for store the mode in eeprom
|
//for store the mode in eeprom
|
||||||
@ -320,8 +320,8 @@ void setNextHamBandFreq(unsigned long f, char moveDirection)
|
|||||||
loadMode = (byte)(resultFreq >> 30);
|
loadMode = (byte)(resultFreq >> 30);
|
||||||
resultFreq = resultFreq & 0x3FFFFFFF;
|
resultFreq = resultFreq & 0x3FFFFFFF;
|
||||||
|
|
||||||
if ((resultFreq / 1000) < hamBandRange[findedIndex][0] || (resultFreq / 1000) > hamBandRange[findedIndex][1])
|
if ((resultFreq / 1000) < hamBandRange[(unsigned char)findedIndex][0] || (resultFreq / 1000) > hamBandRange[(unsigned char)findedIndex][1])
|
||||||
resultFreq = (unsigned long)(hamBandRange[findedIndex][0]) * 1000;
|
resultFreq = (unsigned long)(hamBandRange[(unsigned char)findedIndex][0]) * 1000;
|
||||||
|
|
||||||
setFrequency(resultFreq);
|
setFrequency(resultFreq);
|
||||||
byteWithFreqToMode(loadMode);
|
byteWithFreqToMode(loadMode);
|
||||||
@ -422,8 +422,6 @@ void setTXFilters(unsigned long freq){
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void setFrequency(unsigned long f){
|
void setFrequency(unsigned long f){
|
||||||
uint64_t osc_f;
|
|
||||||
|
|
||||||
//1 digits discarded
|
//1 digits discarded
|
||||||
f = (f / 50) * 50;
|
f = (f / 50) * 50;
|
||||||
|
|
||||||
@ -448,8 +446,6 @@ void setFrequency(unsigned long f){
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void startTx(byte txMode, byte isDisplayUpdate){
|
void startTx(byte txMode, byte isDisplayUpdate){
|
||||||
unsigned long tx_freq = 0;
|
|
||||||
|
|
||||||
//Check Hamband only TX //Not found Hamband index by now frequency
|
//Check Hamband only TX //Not found Hamband index by now frequency
|
||||||
if (tuneTXType >= 100 && getIndexHambanBbyFreq(ritOn ? ritTxFrequency : frequency) == -1) {
|
if (tuneTXType >= 100 && getIndexHambanBbyFreq(ritOn ? ritTxFrequency : frequency) == -1) {
|
||||||
//no message
|
//no message
|
||||||
@ -545,8 +541,6 @@ void checkPTT(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void checkButton(){
|
void checkButton(){
|
||||||
int i, t1, t2, knob, new_knob;
|
|
||||||
|
|
||||||
//only if the button is pressed
|
//only if the button is pressed
|
||||||
if (!btnDown())
|
if (!btnDown())
|
||||||
return;
|
return;
|
||||||
@ -575,7 +569,7 @@ void checkButton(){
|
|||||||
void doTuning(){
|
void doTuning(){
|
||||||
int s = 0;
|
int s = 0;
|
||||||
unsigned long prev_freq;
|
unsigned long prev_freq;
|
||||||
int incdecValue = 0;
|
long incdecValue = 0;
|
||||||
|
|
||||||
if ((vfoActive == VFO_A && ((isDialLock & 0x01) == 0x01)) ||
|
if ((vfoActive == VFO_A && ((isDialLock & 0x01) == 0x01)) ||
|
||||||
(vfoActive == VFO_B && ((isDialLock & 0x02) == 0x02)))
|
(vfoActive == VFO_B && ((isDialLock & 0x02) == 0x02)))
|
||||||
@ -610,7 +604,7 @@ void doTuning(){
|
|||||||
|
|
||||||
if (incdecValue > 0 && frequency + incdecValue > HIGHEST_FREQ_DIAL)
|
if (incdecValue > 0 && frequency + incdecValue > HIGHEST_FREQ_DIAL)
|
||||||
frequency = HIGHEST_FREQ_DIAL;
|
frequency = HIGHEST_FREQ_DIAL;
|
||||||
else if (incdecValue < 0 && frequency < -incdecValue + LOWEST_FREQ_DIAL) //for compute and compare based integer type.
|
else if (incdecValue < 0 && frequency < (unsigned long)(-incdecValue + LOWEST_FREQ_DIAL)) //for compute and compare based integer type.
|
||||||
frequency = LOWEST_FREQ_DIAL;
|
frequency = LOWEST_FREQ_DIAL;
|
||||||
else
|
else
|
||||||
frequency += incdecValue;
|
frequency += incdecValue;
|
||||||
@ -630,8 +624,6 @@ void doTuning(){
|
|||||||
* RIT only steps back and forth by 100 hz at a time
|
* RIT only steps back and forth by 100 hz at a time
|
||||||
*/
|
*/
|
||||||
void doRIT(){
|
void doRIT(){
|
||||||
unsigned long newFreq;
|
|
||||||
|
|
||||||
int knob = enc_read();
|
int knob = enc_read();
|
||||||
unsigned long old_freq = frequency;
|
unsigned long old_freq = frequency;
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#define printLineF1(x) (printLineF(1, x))
|
#define printLineF1(x) (printLineF(1, x))
|
||||||
#define printLineF2(x) (printLineF(0, x))
|
#define printLineF2(x) (printLineF(0, x))
|
||||||
|
|
||||||
int menuBand(int btn){
|
void menuBand(int btn){
|
||||||
int knob = 0;
|
int knob = 0;
|
||||||
int stepChangeCount = 0;
|
int stepChangeCount = 0;
|
||||||
byte btnPressCount = 0;
|
byte btnPressCount = 0;
|
||||||
@ -302,7 +302,7 @@ void menuExit(int btn){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int menuCWSpeed(int btn){
|
void menuCWSpeed(int btn){
|
||||||
int knob = 0;
|
int knob = 0;
|
||||||
int wpm;
|
int wpm;
|
||||||
|
|
||||||
@ -357,7 +357,7 @@ int menuCWSpeed(int btn){
|
|||||||
menuOn = 0;
|
menuOn = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int menuCWAutoKey(int btn){
|
void menuCWAutoKey(int btn){
|
||||||
if (!btn){
|
if (!btn){
|
||||||
printLineF2(F("CW AutoKey Mode?"));
|
printLineF2(F("CW AutoKey Mode?"));
|
||||||
return;
|
return;
|
||||||
@ -380,7 +380,7 @@ int menuCWAutoKey(int btn){
|
|||||||
menuOn = 0;
|
menuOn = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int menuSetupCwDelay(int btn){
|
void menuSetupCwDelay(int btn){
|
||||||
int knob = 0;
|
int knob = 0;
|
||||||
int tmpCWDelay = cwDelayTime * 10;
|
int tmpCWDelay = cwDelayTime * 10;
|
||||||
|
|
||||||
@ -428,7 +428,7 @@ int menuSetupCwDelay(int btn){
|
|||||||
menuOn = 0;
|
menuOn = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int menuSetupTXCWInterval(int btn){
|
void menuSetupTXCWInterval(int btn){
|
||||||
int knob = 0;
|
int knob = 0;
|
||||||
int tmpTXCWInterval = delayBeforeCWStartTime * 2;
|
int tmpTXCWInterval = delayBeforeCWStartTime * 2;
|
||||||
|
|
||||||
@ -491,10 +491,8 @@ int menuSetupTXCWInterval(int btn){
|
|||||||
extern int32_t calibration;
|
extern int32_t calibration;
|
||||||
extern uint32_t si5351bx_vcoa;
|
extern uint32_t si5351bx_vcoa;
|
||||||
|
|
||||||
int factoryCalibration(int btn){
|
void factoryCalibration(int btn){
|
||||||
int knob = 0;
|
int knob = 0;
|
||||||
int32_t prev_calibration;
|
|
||||||
|
|
||||||
|
|
||||||
//keep clear of any previous button press
|
//keep clear of any previous button press
|
||||||
while (btnDown())
|
while (btnDown())
|
||||||
@ -503,10 +501,9 @@ int factoryCalibration(int btn){
|
|||||||
|
|
||||||
if (!btn){
|
if (!btn){
|
||||||
printLineF2(F("Set Calibration?"));
|
printLineF2(F("Set Calibration?"));
|
||||||
return 0;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
prev_calibration = calibration;
|
|
||||||
calibration = 0;
|
calibration = 0;
|
||||||
|
|
||||||
isUSB = true;
|
isUSB = true;
|
||||||
@ -561,13 +558,13 @@ int factoryCalibration(int btn){
|
|||||||
delay(100);
|
delay(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
int menuSetupCalibration(int btn){
|
void menuSetupCalibration(int btn){
|
||||||
int knob = 0;
|
int knob = 0;
|
||||||
int32_t prev_calibration;
|
int32_t prev_calibration;
|
||||||
|
|
||||||
if (!btn){
|
if (!btn){
|
||||||
printLineF2(F("Set Calibration?"));
|
printLineF2(F("Set Calibration?"));
|
||||||
return 0;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
printLineF1(F("Set to Zero-beat,"));
|
printLineF1(F("Set to Zero-beat,"));
|
||||||
|
@ -62,7 +62,7 @@ void i2cWriten(uint8_t reg, uint8_t *vals, uint8_t vcnt) { // write array
|
|||||||
|
|
||||||
|
|
||||||
void si5351bx_init() { // Call once at power-up, start PLLA
|
void si5351bx_init() { // Call once at power-up, start PLLA
|
||||||
uint8_t reg; uint32_t msxp1;
|
uint32_t msxp1;
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
i2cWrite(149, 0); // SpreadSpectrum off
|
i2cWrite(149, 0); // SpreadSpectrum off
|
||||||
i2cWrite(3, si5351bx_clken); // Disable all CLK output drivers
|
i2cWrite(3, si5351bx_clken); // Disable all CLK output drivers
|
||||||
|
@ -115,7 +115,7 @@ void drawMeter(int8_t needle){
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// The generic routine to display one line on the LCD
|
// The generic routine to display one line on the LCD
|
||||||
void printLine(char linenmbr, char *c) {
|
void printLine(unsigned char linenmbr, const char *c) {
|
||||||
if (strcmp(c, printBuff[linenmbr])) { // only refresh the display when there was a change
|
if (strcmp(c, printBuff[linenmbr])) { // only refresh the display when there was a change
|
||||||
lcd.setCursor(0, linenmbr); // place the cursor at the beginning of the selected line
|
lcd.setCursor(0, linenmbr); // place the cursor at the beginning of the selected line
|
||||||
lcd.print(c);
|
lcd.print(c);
|
||||||
@ -160,11 +160,11 @@ void printLineFromEEPRom(char linenmbr, char lcdColumn, byte eepromStartIndex, b
|
|||||||
}
|
}
|
||||||
|
|
||||||
// short cut to print to the first line
|
// short cut to print to the first line
|
||||||
void printLine1(char *c){
|
void printLine1(const char *c){
|
||||||
printLine(1,c);
|
printLine(1,c);
|
||||||
}
|
}
|
||||||
// short cut to print to the first line
|
// short cut to print to the first line
|
||||||
void printLine2(char *c){
|
void printLine2(const char *c){
|
||||||
printLine(0,c);
|
printLine(0,c);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -312,9 +312,9 @@ int enc_read(void) {
|
|||||||
byte newState;
|
byte newState;
|
||||||
int enc_speed = 0;
|
int enc_speed = 0;
|
||||||
|
|
||||||
long stop_by = millis() + 50;
|
unsigned long start_at = millis();
|
||||||
|
|
||||||
while (millis() < stop_by) { // check if the previous state was stable
|
while (millis() - start_at < 50) { // check if the previous state was stable
|
||||||
newState = enc_state(); // Get current state
|
newState = enc_state(); // Get current state
|
||||||
|
|
||||||
if (newState != enc_prev_state)
|
if (newState != enc_prev_state)
|
||||||
|
Loading…
Reference in New Issue
Block a user