diff --git a/ubitx_20/softserial_tiny.cpp b/ubitx_20/softserial_tiny.cpp index b742ca7..4738e87 100644 --- a/ubitx_20/softserial_tiny.cpp +++ b/ubitx_20/softserial_tiny.cpp @@ -103,7 +103,7 @@ uint16_t _rx_delay_intrabit; //Customize for uBITX Protocol int8_t receiveIndex = 0; -int8_t receivedCommandLength = 0; +uint8_t receivedCommandLength = 0; int8_t ffCount = 0; //Values for Receive Buffer diff --git a/ubitx_20/ubitx.h b/ubitx_20/ubitx.h index 4dafcb0..f954d78 100644 --- a/ubitx_20/ubitx.h +++ b/ubitx_20/ubitx.h @@ -76,6 +76,32 @@ extern byte I2C_LCD_SECOND_ADDRESS; //only using Dual LCD Mode #define FN_ADCMONITOR 1 //516 #define FN_TXONOFF 1 //58 +/* +//Test Configuration (88%) +#define FN_BAND 0 //592 +#define FN_VFO_TOGGLE 0 //78 +#define FN_MODE 0 //20 +#define FN_RIT 0 //58 +#define FN_SPLIT 0 //62 +#define FN_IFSHIFT 0 //238 +#define FN_ATT 0 //128 +#define FN_CW_SPEED 1 //152 +#define FN_VFOTOMEM 0 //254 +#define FN_MEMTOVFO 0 //188 +#define FN_MEMORYKEYER 1 //156 +#define FN_WSPR 0 //1044 +#define FN_SDRMODE 1 //68 +#define FN_CALIBRATION 1 //666 +#define FN_CARRIER 1 //382 +#define FN_CWCARRIER 1 //346 +#define FN_CWTONE 1 //148 +#define FN_CWDELAY 1 //98 +#define FN_TXCWDELAY 1 //94 +#define FN_KEYTYPE 1 //168 +#define FN_ADCMONITOR 1 //516 +#define FN_TXONOFF 1 //58 +*/ + /* //Recommended Character LCD Developer 87% #define FN_BAND 1 //592 diff --git a/ubitx_20/ubitx_20.ino b/ubitx_20/ubitx_20.ino index 95d3519..c6e45be 100644 --- a/ubitx_20/ubitx_20.ino +++ b/ubitx_20/ubitx_20.ino @@ -1,4 +1,4 @@ -//Firmware Version + //Firmware Version //+ : This symbol identifies the firmware. // It was originally called 'CEC V1.072' but it is too long to waste the LCD window. // I do not want to make this Firmware users's uBITX messy with my callsign. @@ -1255,6 +1255,8 @@ void setup() initSettings(); initPorts(); +#ifndef USE_SW_SERIAL +//for Chracter LCD if (userCallsignLength > 0 && ((userCallsignLength & 0x80) == 0x80)) { userCallsignLength = userCallsignLength & 0x7F; DisplayCallsign(userCallsignLength); @@ -1264,7 +1266,7 @@ void setup() delay(500); clearLine2(); } - +#endif #ifdef FACTORY_RECOVERY_BOOTUP if (btnDown()) diff --git a/ubitx_20/ubitx_lcd_nextion.ino b/ubitx_20/ubitx_lcd_nextion.ino index 23d70ab..cbac8ac 100644 --- a/ubitx_20/ubitx_lcd_nextion.ino +++ b/ubitx_20/ubitx_lcd_nextion.ino @@ -56,7 +56,6 @@ void LCDNextion_Init() void LCD_Init(void) { LCDNextion_Init(); - //initMeter(); //for Meter Display } //=================================================================== @@ -113,16 +112,16 @@ byte L_scaledSMeter; //scaledSMeter #define CMD_SIDE_TONE 't' //vt unsigned long L_sideTone; //sideTone #define CMD_KEY_TYPE 'k' //ck -byte L_cwKeyType; //L_cwKeyType 0: straight, 1 : iambica, 2: iambicb +byte L_cwKeyType = -1; //L_cwKeyType 0: straight, 1 : iambica, 2: iambicb #define CMD_CW_SPEED 's' //vs unsigned int L_cwSpeed; //cwSpeed #define CMD_CW_DELAY 'y' //vy -byte L_cwDelayTime; //cwDelayTime +byte L_cwDelayTime=-1; //cwDelayTime #define CMD_CW_STARTDELAY 'e' //ve -byte L_delayBeforeCWStartTime; //byte delayBeforeCWStartTime +byte L_delayBeforeCWStartTime=-1; //byte delayBeforeCWStartTime #define CMD_ATT_LEVEL 'f' //vf byte L_attLevel; @@ -188,6 +187,9 @@ byte L_displayOption2; //byte displayOption2 (Reserve) #define TS_CMD_SPECTRUMOPT 15 //Option for Spectrum #define TS_CMD_SPECTRUM 16 //Get Spectrum Value #define TS_CMD_TUNESTEP 17 //Get Spectrum Value +#define TS_CMD_WPM 18 //Set WPM +#define TS_CMD_KEYTYPE 19 //Set KeyType + #define TS_CMD_SWTRIG 21 //SW Action Trigger for WSPR and more #define TS_CMD_READMEM 31 //Read EEProm #define TS_CMD_WRITEMEM 32 //Write EEProm @@ -316,7 +318,7 @@ void SendEEPromData(char varIndex, int eepromStartIndex, int eepromEndIndex, cha SWSerial_Write(0xFF); } -char softBuff1Num[14] = {'p', 'm', '.', 'c', '0', '.', 'v', 'a', 'l', '=', 0, 0xFF, 0xFF, 0xFF}; +uint8_t softBuff1Num[14] = {'p', 'm', '.', 'c', '0', '.', 'v', 'a', 'l', '=', 0, 0xFF, 0xFF, 0xFF}; void SendCommand1Num(char varType, char sendValue) //0~9 : Mode, nowDisp, ActiveVFO, IsDialLock, IsTxtType, IsSplitType { softBuff1Num[4] = varType; @@ -876,7 +878,27 @@ void SWS_Process(void) } else if (commandType == TS_CMD_TUNESTEP) //Set Tune Step { - tuneStepIndex = swr_buffer[commandStartIndex + 4]; //Tune Step Index + tuneStepIndex = swr_buffer[commandStartIndex + 4]; //Tune Step Index + } + else if (commandType == TS_CMD_WPM) //Set WPM + { + cwSpeed = swr_buffer[commandStartIndex + 4]; // + } + else if (commandType == TS_CMD_KEYTYPE) //Set Key Type + { + cwKeyType = swr_buffer[commandStartIndex + 4]; + + //for reduce program memory + Iambic_Key = cwKeyType != 0; + //if (cwKeyType == 0) + // Iambic_Key = false; + //else + //Iambic_Key = true; + if (cwKeyType == 1) + keyerControl &= ~IAMBICB; + else + keyerControl |= IAMBICB; + //} } else if (commandType == TS_CMD_SWTRIG) { @@ -968,11 +990,11 @@ void idle_process() //S-Meter Display if (((displayOption1 & 0x08) == 0x08 && (sdrModeOn == 0)) && (++checkCountSMeter > SMeterLatency)) { - int newSMeter; - #ifdef USE_I2CSMETER scaledSMeter = GetI2CSmeterValue(I2CMETER_CALCS); #else + int newSMeter; + //VK2ETA S-Meter from MAX9814 TC pin newSMeter = analogRead(ANALOG_SMETER) / 4; @@ -999,6 +1021,10 @@ void idle_process() //When boot time, send data void SendUbitxData(void) { + //Wait for ready other device (LCD, DSP and more) + //delay(500); + delay_background(500, 2); + SendCommandL(CMD_AR_TUNE1, arTuneStep[0]); SendCommandL(CMD_AR_TUNE2, arTuneStep[1]); SendCommandL(CMD_AR_TUNE3, arTuneStep[2]); @@ -1014,7 +1040,7 @@ void SendUbitxData(void) EEPROM.get(EXTERNAL_DEVICE_OPT1, nextionDisplayOption); SendCommandUL(CMD_DISP_OPTION2, nextionDisplayOption); - SendCommandStr(CMD_VERSION, "+v1.097"); //Version + SendCommandStr(CMD_VERSION, (char *)("+v1.097")); //Version SendEEPromData(CMD_CALLSIGN, 0, userCallsignLength -1, 0); /* diff --git a/ubitx_20/ubitx_ui.ino b/ubitx_20/ubitx_ui.ino index 91b271c..8ab1579 100644 --- a/ubitx_20/ubitx_ui.ino +++ b/ubitx_20/ubitx_ui.ino @@ -285,17 +285,16 @@ int GetI2CSmeterValue(int valueType) } Wire.requestFrom(I2CMETER_ADDR, 1); - for (int i = 0; i < 100; i++) + + if (Wire.available() > 0) { - if (Wire.available() > 0) - { - return Wire.read(); - } - else - { - delay(1); - } + return Wire.read(); } + //else + //{ + // delay(10); + // return Wire.read(); + //} }