Add Custom LPF Filter and Changed Version Number
This commit is contained in:
		| @@ -28,19 +28,22 @@ | |||||||
| //#define UBITX_DISPLAY_LCD1602I        //I2C type 16 x 02 LCD | //#define UBITX_DISPLAY_LCD1602I        //I2C type 16 x 02 LCD | ||||||
| //#define UBITX_DISPLAY_LCD1602I_DUAL   //I2C type 16 x02 LCD Dual | //#define UBITX_DISPLAY_LCD1602I_DUAL   //I2C type 16 x02 LCD Dual | ||||||
| //#define UBITX_DISPLAY_LCD2004P        //24 x 04 LCD (Parallel) | //#define UBITX_DISPLAY_LCD2004P        //24 x 04 LCD (Parallel) | ||||||
| #define UBITX_DISPLAY_LCD2004I        //I2C type 24 x 04 LCD | //#define UBITX_DISPLAY_LCD2004I        //I2C type 24 x 04 LCD | ||||||
| //#define UBITX_DISPLAY_NEXTION         //NEXTION LCD | #define UBITX_DISPLAY_NEXTION         //NEXTION LCD | ||||||
|  |  | ||||||
| //#define UBITX_DISPLAY_NEXTION_SAFE      //Only EEProm Write 770~775 | //#define UBITX_DISPLAY_NEXTION_SAFE      //Only EEProm Write 770~775 | ||||||
| #define I2C_LCD_MASTER_ADDRESS_DEFAULT  0x27     //0x27  //DEFAULT, if Set I2C Address by uBITX Manager, read from EEProm | #define I2C_LCD_MASTER_ADDRESS_DEFAULT  0x27     //0x27  //DEFAULT, if Set I2C Address by uBITX Manager, read from EEProm | ||||||
| #define I2C_LCD_SECOND_ADDRESS_DEFAULT  0x3F     //0x27  //only using Dual LCD Mode | #define I2C_LCD_SECOND_ADDRESS_DEFAULT  0x3F     //0x27  //only using Dual LCD Mode | ||||||
|  |  | ||||||
| //Select betwen Analog S-Meter and DSP (I2C) Meter | //Select betwen Analog S-Meter and DSP (I2C) Meter | ||||||
| #define USE_I2CSMETER | //#define USE_I2CSMETER | ||||||
|  |  | ||||||
| #define EXTEND_KEY_GROUP1               //MODE, BAND(-), BAND(+), STEP | #define EXTEND_KEY_GROUP1               //MODE, BAND(-), BAND(+), STEP | ||||||
| //#define EXTEND_KEY_GROUP2             //Numeric (0~9), Point(.), Enter  //Not supported in Version 1.0x | //#define EXTEND_KEY_GROUP2             //Numeric (0~9), Point(.), Enter  //Not supported in Version 1.0x | ||||||
|  |  | ||||||
|  | //Custom LPF Filter Mod | ||||||
|  | //#define USE_CUSTOM_LPF_FILTER           //LPF FILTER MOD | ||||||
|  |  | ||||||
| //#define ENABLE_FACTORYALIGN | //#define ENABLE_FACTORYALIGN | ||||||
| #define FACTORY_RECOVERY_BOOTUP         //Whether to enter Factory Recovery mode by pressing FKey and turning on power | #define FACTORY_RECOVERY_BOOTUP         //Whether to enter Factory Recovery mode by pressing FKey and turning on power | ||||||
| #define ENABLE_ADCMONITOR               //Starting with Version 1.07, you can read ADC values directly from uBITX Manager. So this function is not necessary. | #define ENABLE_ADCMONITOR               //Starting with Version 1.07, you can read ADC values directly from uBITX Manager. So this function is not necessary. | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ | |||||||
| //    So I put + in the sense that it was improved one by one based on Original Firmware. | //    So I put + in the sense that it was improved one by one based on Original Firmware. | ||||||
| //    This firmware has been gradually changed based on the original firmware created by Farhan, Jack, Jerry and others. | //    This firmware has been gradually changed based on the original firmware created by Farhan, Jack, Jerry and others. | ||||||
|  |  | ||||||
| #define FIRMWARE_VERSION_INFO F("+v1.097")   | #define FIRMWARE_VERSION_INFO F("+v1.100")   | ||||||
| #define FIRMWARE_VERSION_NUM 0x04       //1st Complete Project : 1 (Version 1.061), 2st Project : 2, 1.08: 3, 1.09 : 4 | #define FIRMWARE_VERSION_NUM 0x04       //1st Complete Project : 1 (Version 1.061), 2st Project : 2, 1.08: 3, 1.09 : 4 | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @@ -196,6 +196,13 @@ int ifShiftValue = 0;   // | |||||||
|  |  | ||||||
| byte TriggerBySW = 0;   //Action Start from Nextion LCD, Other MCU | byte TriggerBySW = 0;   //Action Start from Nextion LCD, Other MCU | ||||||
|  |  | ||||||
|  | //Use Custom Filter | ||||||
|  | //#define CUST_LPF_ENABLED 48 | ||||||
|  | //#define CUST_LPF_START   49 | ||||||
|  | char isCustomFilter = 0; | ||||||
|  | char isCustomFilter_A7 = 0; | ||||||
|  | char CustFilters[7][2]; | ||||||
|  |                                | ||||||
| /** | /** | ||||||
|  * Below are the basic functions that control the uBitx. Understanding the functions before  |  * Below are the basic functions that control the uBitx. Understanding the functions before  | ||||||
|  * you start hacking around |  * you start hacking around | ||||||
| @@ -317,7 +324,24 @@ byte delay_background(unsigned delayTime, byte fromType){ //fromType : 4 autoCWK | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| void setTXFilters(unsigned long freq){ | void setTXFilters(unsigned long freq){ | ||||||
|  | #ifdef USE_CUSTOM_LPF_FILTER  | ||||||
|  |   freq = freq / 1000000UL; | ||||||
|  |   for (byte i = 0; i < 7; i++) { | ||||||
|  |     if (freq > CustFilters[i][0]) | ||||||
|  |     { | ||||||
|  |       char aIn = CustFilters[i][1]; | ||||||
|  |       digitalWrite(TX_LPF_A, aIn & 0x01); | ||||||
|  |       digitalWrite(TX_LPF_B, aIn & 0x02); | ||||||
|  |       digitalWrite(TX_LPF_C, aIn & 0x04); | ||||||
|  |  | ||||||
|  |       if (isCustomFilter_A7 == 1) | ||||||
|  |       { | ||||||
|  |         digitalWrite(A7, aIn & 0x08); | ||||||
|  |       } | ||||||
|  |       return; | ||||||
|  |     } | ||||||
|  |   } //end of for | ||||||
|  | #else | ||||||
|   if (freq > 21000000L){  // the default filter is with 35 MHz cut-off |   if (freq > 21000000L){  // the default filter is with 35 MHz cut-off | ||||||
|     digitalWrite(TX_LPF_A, 0); |     digitalWrite(TX_LPF_A, 0); | ||||||
|     digitalWrite(TX_LPF_B, 0); |     digitalWrite(TX_LPF_B, 0); | ||||||
| @@ -338,6 +362,8 @@ void setTXFilters(unsigned long freq){ | |||||||
|     digitalWrite(TX_LPF_B, 1); |     digitalWrite(TX_LPF_B, 1); | ||||||
|     digitalWrite(TX_LPF_C, 1);     |     digitalWrite(TX_LPF_C, 1);     | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | #endif | ||||||
| } | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @@ -951,6 +977,24 @@ void initSettings(){ | |||||||
|     KeyValues[i][2] = EEPROM.read(EXTENDED_KEY_RANGE + (i * 3) + 2);    //KEY TYPE  |     KeyValues[i][2] = EEPROM.read(EXTENDED_KEY_RANGE + (i * 3) + 2);    //KEY TYPE  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | #ifdef USE_CUSTOM_LPF_FILTER  | ||||||
|  |   //Custom Filters | ||||||
|  |   EEPROM.get(CUST_LPF_ENABLED, isCustomFilter); | ||||||
|  |   if (isCustomFilter == 0x58) | ||||||
|  |   { | ||||||
|  |     isCustomFilter_A7 = 1; | ||||||
|  |   } | ||||||
|  |   isCustomFilter = (isCustomFilter == 0x58 || isCustomFilter == 0x57); | ||||||
|  |    | ||||||
|  |   for (byte i = 0; i < 7; i++) { | ||||||
|  |     CustFilters[i][0] = EEPROM.read(CUST_LPF_START + (i * 2));        //LPF (To) Mhz | ||||||
|  |     CustFilters[i][1] = EEPROM.read(CUST_LPF_START + (i * 2) + 1);    //Enabled I/O | ||||||
|  |   } | ||||||
|  | //char isCustomFilter = 0; | ||||||
|  | //char isCustomFilter_A7 = 0; | ||||||
|  | //char CustFilters[2][7]; | ||||||
|  | #endif | ||||||
|  |  | ||||||
|   //User callsign information |   //User callsign information | ||||||
|   if (EEPROM.read(USER_CALLSIGN_KEY) == 0x59) |   if (EEPROM.read(USER_CALLSIGN_KEY) == 0x59) | ||||||
|     userCallsignLength = EEPROM.read(USER_CALLSIGN_LEN);  //MAXIMUM 18 LENGTH |     userCallsignLength = EEPROM.read(USER_CALLSIGN_LEN);  //MAXIMUM 18 LENGTH | ||||||
|   | |||||||
| @@ -39,6 +39,20 @@ | |||||||
| //============================================================================== | //============================================================================== | ||||||
| #define RESERVE_FOR_FACTORY1  32 | #define RESERVE_FOR_FACTORY1  32 | ||||||
|  |  | ||||||
|  | //============================================================================== | ||||||
|  | // custom LPF Filter | ||||||
|  | // 48 : Using Custom LPF Filter  (48 = 0x57 or 0x58 => Using Custom LPF Filter, 0x58 = using A7 IO | ||||||
|  | // 49, 50 : LPF1  (49 : MHz  (~ Mhz), 50 : Enabled PIN | ||||||
|  | // 51, 52 : LPF2 | ||||||
|  | // 53, 54 : LPF3 | ||||||
|  | // 55, 56 : LPF4 | ||||||
|  | // 57, 58 : LPF5 | ||||||
|  | // 59, 60 : LPF6 | ||||||
|  | // 61, 62 : LPF7 | ||||||
|  | //============================================================================== | ||||||
|  | #define CUST_LPF_ENABLED 48 | ||||||
|  | #define CUST_LPF_START   49 | ||||||
|  |  | ||||||
| //SI5351 I2C Address (Version 1.097) | //SI5351 I2C Address (Version 1.097) | ||||||
| #define I2C_ADDR_SI5351       63 | #define I2C_ADDR_SI5351       63 | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1041,7 +1041,7 @@ void SendUbitxData(void) | |||||||
|   EEPROM.get(EXTERNAL_DEVICE_OPT1, nextionDisplayOption);  |   EEPROM.get(EXTERNAL_DEVICE_OPT1, nextionDisplayOption);  | ||||||
|   SendCommandUL(CMD_DISP_OPTION2, nextionDisplayOption); |   SendCommandUL(CMD_DISP_OPTION2, nextionDisplayOption); | ||||||
|  |  | ||||||
|   SendCommandStr(CMD_VERSION, (char *)("+v1.097")); //Version |   SendCommandStr(CMD_VERSION, (char *)("+v1.100")); //Version | ||||||
|   SendEEPromData(CMD_CALLSIGN, 0, userCallsignLength -1, 0); |   SendEEPromData(CMD_CALLSIGN, 0, userCallsignLength -1, 0); | ||||||
|  |  | ||||||
|   /* |   /* | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user