From 2fa824750131a548dd784130091923a0ca7cef87 Mon Sep 17 00:00:00 2001 From: phdlee Date: Sat, 20 Jan 2018 22:05:04 +0900 Subject: [PATCH] v0.29 prepare --- README.md | 56 +++++++++++++++++++++++++++++++++++++++ ubitx_20/cat_libs.ino | 2 +- ubitx_20/cw_autokey.ino | 8 ++++-- ubitx_20/ubitx_20.ino | 20 +++++--------- ubitx_20/ubitx_menu.ino | 21 +++++++-------- ubitx_20/ubitx_si5351.ino | 2 +- ubitx_20/ubitx_ui.ino | 10 +++---- 7 files changed, 84 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 66b1ddd..79f9917 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,67 @@ +#IMPORTANT INFORMATION +---------------------------------------------------------------------------- +- Beta 0.26 and Beta 0.261, Beta 0.262, Beta 0.27 is complete test +- You can download and use it. + +#NOTICE +---------------------------------------------------------------------------- +I received uBITX a month ago and found that many features are required, and began coding with the idea of implementing minimal functionality as a general hf transceiver rather than an experimental device. + +- fixed bugs... +- Diallock for uBITX's sensitive encoders +- built in softare Memory keyer and cw options control for CW communication +- Implementation of CAT communication protocol for Digital Communication (as FT8, JT65, etc) +- Delay Options for external Linear. +- and more... + +Most of the basic functions of the HF transceiver I thought were implemented. +The minimum basic specification for uBITX to operate as a radio, I think it is finished. +So I will release the 0.27 version and if I do not see the bug anymore, I will try to change the version name to 1.0. +Now uBITX is an HF radio and will be able to join you in your happy hams life. +Based on this source, you can use it by adding functions. + +I am going to do a new project based on this source, linking with WSPR, WSJT-X and so on. +Of course, this repository is still running. If you have any bugs or ideas, please feel free to email me. + +http://www.hamskey.com + +DE KD8CEC +kd8cec@gmail.com + #uBITX uBITX firmware, written for the Raduino/Arduino control of uBITX transceivers This project is based on https://github.com/afarhan/ubitx and all copyright is inherited. The copyright information of the original is below. KD8CEC +---------------------------------------------------------------------------- +Prepared or finished tasks for the next version + - Most of them are implemented and included in version 0.27. + - User Interface on LCD -> Option by user (not need) + - Include WSPR Beacone function - (implement other new repository) + complete experiment + need solve : Big code size (over 100%, then remove some functions for experment) + need replace Si5351 Library (increase risk and need more beta tester) + W3PM sent me his wonderful source - using BITX, GPS + ---------------------------------------------------------------------------- ## REVISION RECORD +0.27 + (First alpha test version, This will be renamed to the major version 1.0) + - Dual VFO Dial Lock (vfoA Dial lock) + - Support Ham band on uBITX + default Hamband is regeion1 but customize by uBITX Manager Software + - Advanced ham band options (Tx control) for use in all countries. You can adjust it yourself. + - Convenience of band movement + +0.26 + - only Beta tester released & source code share + - find a bug on none initial eeprom uBITX - Fixed (Check -> initialized & compatible original source code) + - change the version number 0.26 -> 0.27 + - Prevent overflow bugs + - bug with linux based Hamlib (raspberry pi), It was perfect for the 0.224 version, but there was a problem for the 0.25 version. + On Windows, ham deluxe, wsjt-x, jt65-hf, and fldigi were successfully run. Problem with Raspberry pi. + 0.25 - Beta Version Released http://www.hamskey.com/2018/01/release-beta-version-of-cat-support.html diff --git a/ubitx_20/cat_libs.ino b/ubitx_20/cat_libs.ino index b0aae87..b4c67ec 100644 --- a/ubitx_20/cat_libs.ino +++ b/ubitx_20/cat_libs.ino @@ -398,7 +398,7 @@ void ReadEEPRom_FT817(byte fromType) void WriteEEPRom_FT817(byte fromType) { - byte temp0 = CAT_BUFF[0]; + //byte temp0 = CAT_BUFF[0]; byte temp1 = CAT_BUFF[1]; CAT_BUFF[0] = 0; diff --git a/ubitx_20/cw_autokey.ino b/ubitx_20/cw_autokey.ino index 7c6cc75..3dfbb3b 100644 --- a/ubitx_20/cw_autokey.ino +++ b/ubitx_20/cw_autokey.ino @@ -208,10 +208,14 @@ void sendCWChar(char cwKeyChar) charLength = ((tmpChar >> 6) & 0x03) + 3; for (j = 0; j < charLength; j++) - sendBuff[j] = (tmpChar << j + 2) & 0x80; + sendBuff[j] = (tmpChar << (j + 2)) & 0x80; break; } + else + { + charLength = 0; + } } } @@ -257,7 +261,7 @@ unsigned long scrollDispayTime = 0; #define scrollSpeed 500 byte displayScrolStep = 0; -int controlAutoCW(){ +void controlAutoCW(){ int knob = 0; byte i; diff --git a/ubitx_20/ubitx_20.ino b/ubitx_20/ubitx_20.ino index fa644a1..5a2b8b6 100644 --- a/ubitx_20/ubitx_20.ino +++ b/ubitx_20/ubitx_20.ino @@ -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 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; //for store the mode in eeprom @@ -320,8 +320,8 @@ void setNextHamBandFreq(unsigned long f, char moveDirection) loadMode = (byte)(resultFreq >> 30); resultFreq = resultFreq & 0x3FFFFFFF; - if ((resultFreq / 1000) < hamBandRange[findedIndex][0] || (resultFreq / 1000) > hamBandRange[findedIndex][1]) - resultFreq = (unsigned long)(hamBandRange[findedIndex][0]) * 1000; + if ((resultFreq / 1000) < hamBandRange[(unsigned char)findedIndex][0] || (resultFreq / 1000) > hamBandRange[(unsigned char)findedIndex][1]) + resultFreq = (unsigned long)(hamBandRange[(unsigned char)findedIndex][0]) * 1000; setFrequency(resultFreq); byteWithFreqToMode(loadMode); @@ -344,7 +344,7 @@ unsigned long delayBeforeTime = 0; byte delay_background(unsigned delayTime, byte fromType){ //fromType : 4 autoCWKey -> Check Paddle delayBeforeTime = millis(); - while (millis() <= delayBeforeTime + delayTime) { + while (millis() - delayBeforeTime <= delayTime) { if (fromType == 4) { @@ -422,8 +422,6 @@ void setTXFilters(unsigned long freq){ */ void setFrequency(unsigned long f){ - uint64_t osc_f; - //1 digits discarded f = (f / 50) * 50; @@ -448,8 +446,6 @@ void setFrequency(unsigned long f){ */ void startTx(byte txMode, byte isDisplayUpdate){ - unsigned long tx_freq = 0; - //Check Hamband only TX //Not found Hamband index by now frequency if (tuneTXType >= 100 && getIndexHambanBbyFreq(ritOn ? ritTxFrequency : frequency) == -1) { //no message @@ -545,8 +541,6 @@ void checkPTT(){ } void checkButton(){ - int i, t1, t2, knob, new_knob; - //only if the button is pressed if (!btnDown()) return; @@ -575,7 +569,7 @@ void checkButton(){ void doTuning(){ int s = 0; unsigned long prev_freq; - int incdecValue = 0; + long incdecValue = 0; if ((vfoActive == VFO_A && ((isDialLock & 0x01) == 0x01)) || (vfoActive == VFO_B && ((isDialLock & 0x02) == 0x02))) @@ -610,7 +604,7 @@ void doTuning(){ if (incdecValue > 0 && frequency + incdecValue > 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; else frequency += incdecValue; @@ -630,8 +624,6 @@ void doTuning(){ * RIT only steps back and forth by 100 hz at a time */ void doRIT(){ - unsigned long newFreq; - int knob = enc_read(); unsigned long old_freq = frequency; diff --git a/ubitx_20/ubitx_menu.ino b/ubitx_20/ubitx_menu.ino index 02388c4..3b58636 100644 --- a/ubitx_20/ubitx_menu.ino +++ b/ubitx_20/ubitx_menu.ino @@ -13,7 +13,7 @@ #define printLineF1(x) (printLineF(1, x)) #define printLineF2(x) (printLineF(0, x)) -int menuBand(int btn){ +void menuBand(int btn){ int knob = 0; int stepChangeCount = 0; byte btnPressCount = 0; @@ -302,7 +302,7 @@ void menuExit(int btn){ } } -int menuCWSpeed(int btn){ +void menuCWSpeed(int btn){ int knob = 0; int wpm; @@ -357,7 +357,7 @@ int menuCWSpeed(int btn){ menuOn = 0; } -int menuCWAutoKey(int btn){ +void menuCWAutoKey(int btn){ if (!btn){ printLineF2(F("CW AutoKey Mode?")); return; @@ -380,7 +380,7 @@ int menuCWAutoKey(int btn){ menuOn = 0; } -int menuSetupCwDelay(int btn){ +void menuSetupCwDelay(int btn){ int knob = 0; int tmpCWDelay = cwDelayTime * 10; @@ -428,7 +428,7 @@ int menuSetupCwDelay(int btn){ menuOn = 0; } -int menuSetupTXCWInterval(int btn){ +void menuSetupTXCWInterval(int btn){ int knob = 0; int tmpTXCWInterval = delayBeforeCWStartTime * 2; @@ -491,10 +491,8 @@ int menuSetupTXCWInterval(int btn){ extern int32_t calibration; extern uint32_t si5351bx_vcoa; -int factoryCalibration(int btn){ +void factoryCalibration(int btn){ int knob = 0; - int32_t prev_calibration; - //keep clear of any previous button press while (btnDown()) @@ -503,10 +501,9 @@ int factoryCalibration(int btn){ if (!btn){ printLineF2(F("Set Calibration?")); - return 0; + return; } - prev_calibration = calibration; calibration = 0; isUSB = true; @@ -561,13 +558,13 @@ int factoryCalibration(int btn){ delay(100); } -int menuSetupCalibration(int btn){ +void menuSetupCalibration(int btn){ int knob = 0; int32_t prev_calibration; if (!btn){ printLineF2(F("Set Calibration?")); - return 0; + return; } printLineF1(F("Set to Zero-beat,")); diff --git a/ubitx_20/ubitx_si5351.ino b/ubitx_20/ubitx_si5351.ino index a5d3ed4..b437ad9 100644 --- a/ubitx_20/ubitx_si5351.ino +++ b/ubitx_20/ubitx_si5351.ino @@ -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 - uint8_t reg; uint32_t msxp1; + uint32_t msxp1; Wire.begin(); i2cWrite(149, 0); // SpreadSpectrum off i2cWrite(3, si5351bx_clken); // Disable all CLK output drivers diff --git a/ubitx_20/ubitx_ui.ino b/ubitx_20/ubitx_ui.ino index a4c4798..f309fcc 100644 --- a/ubitx_20/ubitx_ui.ino +++ b/ubitx_20/ubitx_ui.ino @@ -115,7 +115,7 @@ void drawMeter(int8_t needle){ */ // 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 lcd.setCursor(0, linenmbr); // place the cursor at the beginning of the selected line lcd.print(c); @@ -160,11 +160,11 @@ void printLineFromEEPRom(char linenmbr, char lcdColumn, byte eepromStartIndex, b } // short cut to print to the first line -void printLine1(char *c){ +void printLine1(const char *c){ printLine(1,c); } // short cut to print to the first line -void printLine2(char *c){ +void printLine2(const char *c){ printLine(0,c); } @@ -312,9 +312,9 @@ int enc_read(void) { byte newState; 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 if (newState != enc_prev_state)