Some changes
This commit is contained in:
@@ -0,0 +1,261 @@
|
|||||||
|
# PC Control Interface
|
||||||
|
|
||||||
|
The PC Control Interface of the firmware allows the PC to do useful things with the radio directly.
|
||||||
|
|
||||||
|
## Invoking
|
||||||
|
|
||||||
|
Any time, ever, the PC ("Serial device") can send a "~/" on the data line, once the radio is ready for command (or already is), a response will get received: [0x01 0xFF].
|
||||||
|
|
||||||
|
That means, we can send commands to the radio now.
|
||||||
|
|
||||||
|
## Packet
|
||||||
|
|
||||||
|
Every single packet starts with its length, example: [0x02 0xAA 0x55] [0x03 0x00 0x01 0x02]
|
||||||
|
|
||||||
|
The byte after the lenght is expected to be the command, which will be defined below
|
||||||
|
|
||||||
|
### Commands
|
||||||
|
|
||||||
|
#### 0 - Set clock
|
||||||
|
|
||||||
|
This sets the I2C clock.
|
||||||
|
|
||||||
|
4 bytes after command should represent the clock to set as commanded.
|
||||||
|
|
||||||
|
##### Example
|
||||||
|
|
||||||
|
Set clock to 400 kHz
|
||||||
|
|
||||||
|
[0x05] - Length
|
||||||
|
|
||||||
|
[0x00] - Command
|
||||||
|
|
||||||
|
[0x00] - MSB Byte of clock value
|
||||||
|
|
||||||
|
[0x06]
|
||||||
|
|
||||||
|
[0x1A]
|
||||||
|
|
||||||
|
[0x80] - LSB Byte of the clock value
|
||||||
|
|
||||||
|
##### Response
|
||||||
|
|
||||||
|
[0x01] - Length
|
||||||
|
|
||||||
|
[0x00] - Response to command 0
|
||||||
|
|
||||||
|
#### 1 - Send I2C data
|
||||||
|
|
||||||
|
This command sends out the provided data to a provided address over I2C
|
||||||
|
|
||||||
|
First byte after the command should be the address, and the rest until the end of the command shall be the data itself
|
||||||
|
|
||||||
|
##### Structure
|
||||||
|
|
||||||
|
[0x03] - Length
|
||||||
|
|
||||||
|
[0x01] - Command
|
||||||
|
|
||||||
|
[X] - Device address
|
||||||
|
|
||||||
|
[X] - Address to set on the device (data)
|
||||||
|
|
||||||
|
[X] - Address contents on the device (data)
|
||||||
|
|
||||||
|
##### Response
|
||||||
|
|
||||||
|
[0x02] - Length
|
||||||
|
|
||||||
|
[0x01] - Response to command 0
|
||||||
|
|
||||||
|
[X] - Arbitrary status value which matches the value of Arduino's endTransmission function
|
||||||
|
|
||||||
|
#### 2 - Send + Receive I2C data
|
||||||
|
|
||||||
|
This command sends out the provided data to a provided address over I2C, but then sends a repeated start and requests a number of bytes which is provided by the command
|
||||||
|
|
||||||
|
First byte after the command should be the address, the following byte should be the lenght of the data to send before reading, the message that is to be send should be sent now, and the last byte should be the number of bytes to receive from the device
|
||||||
|
|
||||||
|
##### Example
|
||||||
|
|
||||||
|
[0x03] - Length
|
||||||
|
|
||||||
|
[0x02] - Command
|
||||||
|
|
||||||
|
[X] - Device address
|
||||||
|
|
||||||
|
[X] - Length of data to send
|
||||||
|
|
||||||
|
[X] - Actual data
|
||||||
|
|
||||||
|
[n] - Request two bytes from the device
|
||||||
|
|
||||||
|
##### Response
|
||||||
|
|
||||||
|
[0x02+n] - Length
|
||||||
|
|
||||||
|
[0x02] - Response to command 2
|
||||||
|
|
||||||
|
[X] - Arbitrary status value which matches the value of Arduino's endTransmission function
|
||||||
|
|
||||||
|
n*[X] - Data received from the device
|
||||||
|
|
||||||
|
#### 3 - Quit
|
||||||
|
|
||||||
|
This commands quits the control interface.
|
||||||
|
|
||||||
|
It will also reset the baud rate to 115200
|
||||||
|
|
||||||
|
##### Example
|
||||||
|
|
||||||
|
[0x01] - Length
|
||||||
|
|
||||||
|
[0x03] - Command
|
||||||
|
|
||||||
|
##### Response
|
||||||
|
|
||||||
|
[0x01] - Length
|
||||||
|
|
||||||
|
[0x03] - Response to command 3
|
||||||
|
|
||||||
|
#### 4 - Protocol version
|
||||||
|
|
||||||
|
Returns the current protocol version
|
||||||
|
|
||||||
|
##### Example
|
||||||
|
|
||||||
|
[0x01] - Length
|
||||||
|
|
||||||
|
[0x04] - Command
|
||||||
|
|
||||||
|
##### Response
|
||||||
|
|
||||||
|
[0x02] - Length
|
||||||
|
|
||||||
|
[0x04] - Response to command 4
|
||||||
|
|
||||||
|
[0x02] - Current protocol version
|
||||||
|
|
||||||
|
#### 5 - Reboot
|
||||||
|
|
||||||
|
This command will reset the ESP32
|
||||||
|
|
||||||
|
##### Example
|
||||||
|
|
||||||
|
[0x01] - Length
|
||||||
|
|
||||||
|
[0x05] - Command
|
||||||
|
|
||||||
|
##### Response
|
||||||
|
|
||||||
|
[0x01] - Length
|
||||||
|
|
||||||
|
[0x05] - Response to command 5
|
||||||
|
|
||||||
|
#### 6 - Change baud rate
|
||||||
|
|
||||||
|
This will change the baud rate. Response of this command is still in the prev baud rate.
|
||||||
|
|
||||||
|
##### Example
|
||||||
|
|
||||||
|
Set baud rate to 921600
|
||||||
|
|
||||||
|
[0x05] - Length
|
||||||
|
|
||||||
|
[0x06] - Command
|
||||||
|
|
||||||
|
[0x00] - MSB byte of baud rate
|
||||||
|
|
||||||
|
[0x0E]
|
||||||
|
|
||||||
|
[0x10]
|
||||||
|
|
||||||
|
[0x00] - LSB byte of baud rate
|
||||||
|
|
||||||
|
##### Response
|
||||||
|
|
||||||
|
[0x01] - Length
|
||||||
|
|
||||||
|
[0x06] - Response to command 6
|
||||||
|
|
||||||
|
#### 7 - Write to EEPROM
|
||||||
|
|
||||||
|
This command will write to the NVS of the ESP32
|
||||||
|
|
||||||
|
This command is only available on versions 2+
|
||||||
|
|
||||||
|
##### Example
|
||||||
|
|
||||||
|
Store 0xff at address 0x10
|
||||||
|
|
||||||
|
[0x04] - Length
|
||||||
|
|
||||||
|
[0x07] - Command
|
||||||
|
|
||||||
|
[0x00] - MSB byte of address
|
||||||
|
|
||||||
|
[0x10] - LSB byte of address
|
||||||
|
|
||||||
|
[0xff]
|
||||||
|
|
||||||
|
Store 0xffaa at address 0x5555
|
||||||
|
|
||||||
|
[0x04] - Length
|
||||||
|
|
||||||
|
[0x07] - Command
|
||||||
|
|
||||||
|
[0x55] - MSB byte of address
|
||||||
|
|
||||||
|
[0x55] - LSB byte of address
|
||||||
|
|
||||||
|
[0xff]
|
||||||
|
|
||||||
|
[0xaa]
|
||||||
|
|
||||||
|
##### Response
|
||||||
|
|
||||||
|
[0x01] - Length
|
||||||
|
|
||||||
|
[0x07] - Response to command 7
|
||||||
|
|
||||||
|
#### 8 - Read from EEPROM
|
||||||
|
|
||||||
|
This command will read from the NVS of the ESP32
|
||||||
|
|
||||||
|
This command is only available on versions 2+
|
||||||
|
|
||||||
|
##### Structure
|
||||||
|
|
||||||
|
[0x04] - Length
|
||||||
|
|
||||||
|
[0x08] - Command
|
||||||
|
|
||||||
|
[X] - MSB byte of address
|
||||||
|
|
||||||
|
[X] - LSB byte of address
|
||||||
|
|
||||||
|
[n] - Length to read
|
||||||
|
|
||||||
|
##### Response
|
||||||
|
|
||||||
|
[0x01 + n] - Length
|
||||||
|
|
||||||
|
[0x08] - Response to command 8
|
||||||
|
|
||||||
|
n*[X] - Data read from EEPROM
|
||||||
|
|
||||||
|
#### 255 - Ping / Wake
|
||||||
|
|
||||||
|
This command is only available on versions 2+
|
||||||
|
|
||||||
|
##### Structure
|
||||||
|
|
||||||
|
[0x01] - Length
|
||||||
|
|
||||||
|
[0xFF] - Command
|
||||||
|
|
||||||
|
##### Response
|
||||||
|
|
||||||
|
[0x01] - Length
|
||||||
|
|
||||||
|
[0xFF] - Response to command 255
|
||||||
+111
-248
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
#define VERSION "v2.20.6b"
|
#define VERSION "v2.20.6c"
|
||||||
|
|
||||||
#define ROTARY_PIN_A 34
|
#define ROTARY_PIN_A 34
|
||||||
#define ROTARY_PIN_B 36
|
#define ROTARY_PIN_B 36
|
||||||
@@ -22,146 +22,137 @@
|
|||||||
|
|
||||||
#define RX8010SJ_ADDRESS 0x32 // Address of the RTC chip in the DP666 receivers
|
#define RX8010SJ_ADDRESS 0x32 // Address of the RTC chip in the DP666 receivers
|
||||||
|
|
||||||
#define REVERSE false
|
#define ALEFT -1
|
||||||
|
#define ACENTER 0
|
||||||
|
#define ARIGHT 1
|
||||||
|
|
||||||
#define ALEFT -1
|
#define TIMER_OFFSET_TIMER 250
|
||||||
#define ACENTER 0
|
#define TIMER_BW_TIMER 300
|
||||||
#define ARIGHT 1
|
#define TIMER_SNR_TIMER 30
|
||||||
|
#define TIMER_BAT_TIMER 750
|
||||||
#define MAX(x, y) (x) < (y) ? (y) : (x)
|
|
||||||
#define MIN(X, Y) {\
|
|
||||||
typeof (X) x_ = (X);\
|
|
||||||
typeof (Y) y_ = (Y);\
|
|
||||||
(x_ < y_) ? x_ : y_; }
|
|
||||||
|
|
||||||
#define TIMER_OFFSET_TIMER 250
|
|
||||||
#define TIMER_BW_TIMER 300
|
|
||||||
#define TIMER_SNR_TIMER 30
|
|
||||||
#define TIMER_BAT_TIMER 750
|
|
||||||
|
|
||||||
// Signal quality thresholds for scanning
|
// Signal quality thresholds for scanning
|
||||||
#define SCAN_SIGNAL_THRESHOLD_USN_MULTIPLIER 30
|
#define SCAN_SIGNAL_THRESHOLD_USN_MULTIPLIER 30
|
||||||
#define SCAN_SIGNAL_THRESHOLD_WAM 230
|
#define SCAN_SIGNAL_THRESHOLD_WAM 230
|
||||||
#define SCAN_SIGNAL_THRESHOLD_OSTATUS 80
|
#define SCAN_SIGNAL_THRESHOLD_OSTATUS 80
|
||||||
#define SCAN_SIGNAL_THRESHOLD_OSTATUS_WIDE 100
|
#define SCAN_SIGNAL_THRESHOLD_OSTATUS_WIDE 100
|
||||||
|
|
||||||
// Timing constants (milliseconds)
|
// Timing constants (milliseconds)
|
||||||
#define DELAY_TUNE_MS 50
|
#define DELAY_TUNE_MS 50
|
||||||
#define DELAY_UI_UPDATE_MS 200
|
#define DELAY_UI_UPDATE_MS 200
|
||||||
#define DELAY_BUTTON_DEBOUNCE_MS 50
|
#define DELAY_BUTTON_DEBOUNCE_MS 50
|
||||||
#define DELAY_BUTTON_DEBOUNCE_EXTRA_MS 75
|
#define DELAY_BUTTON_DEBOUNCE_EXTRA_MS 75
|
||||||
#define DELAY_KEYPAD_TIMEOUT_MS 2000
|
#define DELAY_KEYPAD_TIMEOUT_MS 2000
|
||||||
#define DELAY_RDS_READ_MS 60
|
#define DELAY_RDS_READ_MS 60
|
||||||
#define DELAY_TOUCH_REPEAT_MS 500
|
#define DELAY_TOUCH_REPEAT_MS 500
|
||||||
#define TOT_MULTIPLIER_MS 60000
|
#define TOT_MULTIPLIER_MS 60000
|
||||||
#define NTP_UPDATE_INTERVAL_MS 1800000
|
#define NTP_UPDATE_INTERVAL_MS 1800000
|
||||||
#define UDP_LOG_INTERVAL_MS 500
|
#define UDP_LOG_INTERVAL_MS 500
|
||||||
#define SCAN_HOLD_DEFAULT_MS 500
|
#define SCAN_HOLD_DEFAULT_MS 500
|
||||||
|
|
||||||
// UI layout coordinates
|
// UI layout coordinates
|
||||||
#define STEREO_ICON_X 32
|
#define STEREO_ICON_X 32
|
||||||
#define STEREO_ICON_Y 5
|
#define STEREO_ICON_Y 5
|
||||||
#define WIFI_ICON_X 282
|
#define WIFI_ICON_X 282
|
||||||
#define WIFI_ICON_Y 3
|
#define WIFI_ICON_Y 3
|
||||||
#define WIFI_ICON_WIDTH 30
|
#define WIFI_ICON_WIDTH 30
|
||||||
#define WIFI_ICON_HEIGHT 25
|
#define WIFI_ICON_HEIGHT 25
|
||||||
#define SPEAKER_ICON_X 249
|
#define SPEAKER_ICON_X 249
|
||||||
#define SPEAKER_ICON_Y 4
|
#define SPEAKER_ICON_Y 4
|
||||||
#define SPEAKER_ICON_WIDTH 28
|
#define SPEAKER_ICON_WIDTH 28
|
||||||
#define SPEAKER_ICON_HEIGHT 24
|
#define SPEAKER_ICON_HEIGHT 24
|
||||||
|
|
||||||
// Touch thresholds
|
// Touch thresholds
|
||||||
#define TOUCH_RAW_Z_THRESHOLD 250
|
#define TOUCH_RAW_Z_THRESHOLD 235
|
||||||
|
|
||||||
// Battery detection
|
// Battery detection
|
||||||
#define BATTERY_DETECT_THRESHOLD 200
|
#define BATTERY_DETECT_THRESHOLD 200 // About 0.161V
|
||||||
|
|
||||||
// Squelch values
|
// Squelch values
|
||||||
#define SQUELCH_MAX_VALUE 920
|
#define SQUELCH_MAX_VALUE 920
|
||||||
|
|
||||||
#define BAT_LEVEL_STAGE 8
|
#define BATTERY_LOW_VALUE 3.2
|
||||||
#define BATTERY_LOW_VALUE 3.2
|
#define BATTERY_FULL_VALUE 4.12
|
||||||
#define BATTERY_FULL_VALUE 4.12
|
|
||||||
|
|
||||||
#define XTAL_MV_TOL 300
|
#define XTAL_MV_TOL 300
|
||||||
|
|
||||||
#define LANGUAGE_CHS 14
|
#define LANGUAGE_CHS 14
|
||||||
|
|
||||||
#define FREQ_MW_STEP_9K 9
|
#define FREQ_MW_STEP_9K 9
|
||||||
#define FREQ_MW_STEP_10K 10
|
#define FREQ_MW_STEP_10K 10
|
||||||
#define FREQ_SW_STEP_5K 5
|
#define FREQ_SW_STEP_5K 5
|
||||||
#define FREQ_OIRT_STEP_30K 3
|
#define FREQ_OIRT_STEP_30K 3
|
||||||
#define FREQ_FM_STEP_50K 5
|
#define FREQ_FM_STEP_50K 5
|
||||||
#define FREQ_FM_STEP_100K 10
|
#define FREQ_FM_STEP_100K 10
|
||||||
#define FREQ_FM_STEP_200K 20
|
#define FREQ_FM_STEP_200K 20
|
||||||
|
|
||||||
#define FREQ_LW_LOW_EDGE_MIN 144
|
#define FREQ_LW_LOW_EDGE_MIN 144
|
||||||
#define FREQ_LW_HIGH_EDGE_MAX 513
|
#define FREQ_LW_HIGH_EDGE_MAX 513
|
||||||
#define FREQ_MW_LOW_EDGE_MIN_9K 522
|
#define FREQ_MW_LOW_EDGE_MIN_9K 522
|
||||||
#define FREQ_MW_LOW_EDGE_MIN_10K 520
|
#define FREQ_MW_LOW_EDGE_MIN_10K 520
|
||||||
#define FREQ_MW_HIGH_EDGE_MAX_9K 1791
|
#define FREQ_MW_HIGH_EDGE_MAX_9K 1791
|
||||||
#define FREQ_MW_HIGH_EDGE_MAX_10K 1720
|
#define FREQ_MW_HIGH_EDGE_MAX_10K 1720
|
||||||
#define FREQ_SW_LOW_EDGE_MIN 1700
|
#define FREQ_SW_LOW_EDGE_MIN 1700
|
||||||
#define FREQ_SW_LOW_EDGE_MAX (FREQ_SW_160M_START)
|
#define FREQ_SW_LOW_EDGE_MAX (FREQ_SW_160M_START)
|
||||||
#define FREQ_SW_HIGH_EDGE_MIN (FREQ_SW_11M_END)
|
#define FREQ_SW_HIGH_EDGE_MIN (FREQ_SW_11M_END)
|
||||||
#define FREQ_SW_HIGH_EDGE_MAX (FREQ_SW_END)
|
#define FREQ_SW_HIGH_EDGE_MAX (FREQ_SW_END)
|
||||||
|
|
||||||
#define FREQ_FM_OIRT_START 6500 // use values of 1/10 * kHz
|
#define FREQ_FM_OIRT_START 6500 // use values of 1/10 * kHz
|
||||||
#define FREQ_FM_OIRT_END 7400 // use values of 1/10 * kHz
|
#define FREQ_FM_OIRT_END 7400 // use values of 1/10 * kHz
|
||||||
|
|
||||||
#define REGION_EU 0
|
#define REGION_EU 0
|
||||||
#define REGION_US 1
|
#define REGION_US 1
|
||||||
|
|
||||||
// according to https://www.short-wave.info/index.php?feature=frequencies
|
// according to https://www.short-wave.info/index.php?feature=frequencies
|
||||||
#define FREQ_SW_START 1800
|
#define FREQ_SW_START 1800
|
||||||
#define FREQ_SW_END 27000
|
#define FREQ_SW_END 27000
|
||||||
#define FREQ_SW_160M_START 1800
|
#define FREQ_SW_160M_START 1800
|
||||||
#define FREQ_SW_160M_END 2000
|
#define FREQ_SW_160M_END 2000
|
||||||
#define FREQ_SW_120M_START 2300
|
#define FREQ_SW_120M_START 2300
|
||||||
#define FREQ_SW_120M_END 2495
|
#define FREQ_SW_120M_END 2495
|
||||||
#define FREQ_SW_90M_START 3200
|
#define FREQ_SW_90M_START 3200
|
||||||
#define FREQ_SW_90M_END 3400
|
#define FREQ_SW_90M_END 3400
|
||||||
#define FREQ_SW_75M_START 3900
|
#define FREQ_SW_75M_START 3900
|
||||||
#define FREQ_SW_75M_END 4000
|
#define FREQ_SW_75M_END 4000
|
||||||
#define FREQ_SW_60M_START 4750
|
#define FREQ_SW_60M_START 4750
|
||||||
#define FREQ_SW_60M_END 4995
|
#define FREQ_SW_60M_END 4995
|
||||||
#define FREQ_SW_49M_START 5900
|
#define FREQ_SW_49M_START 5900
|
||||||
#define FREQ_SW_49M_END 6200
|
#define FREQ_SW_49M_END 6200
|
||||||
#define FREQ_SW_41M_START 7200
|
#define FREQ_SW_41M_START 7200
|
||||||
#define FREQ_SW_41M_END 7450
|
#define FREQ_SW_41M_END 7450
|
||||||
#define FREQ_SW_31M_START 9400
|
#define FREQ_SW_31M_START 9400
|
||||||
#define FREQ_SW_31M_END 9900
|
#define FREQ_SW_31M_END 9900
|
||||||
#define FREQ_SW_25M_START 11600
|
#define FREQ_SW_25M_START 11600
|
||||||
#define FREQ_SW_25M_END 12100
|
#define FREQ_SW_25M_END 12100
|
||||||
#define FREQ_SW_22M_START 13570
|
#define FREQ_SW_22M_START 13570
|
||||||
#define FREQ_SW_22M_END 13870
|
#define FREQ_SW_22M_END 13870
|
||||||
#define FREQ_SW_19M_START 15100
|
#define FREQ_SW_19M_START 15100
|
||||||
#define FREQ_SW_19M_END 15800
|
#define FREQ_SW_19M_END 15800
|
||||||
#define FREQ_SW_16M_START 17480
|
#define FREQ_SW_16M_START 17480
|
||||||
#define FREQ_SW_16M_END 17900
|
#define FREQ_SW_16M_END 17900
|
||||||
#define FREQ_SW_15M_START 18900
|
#define FREQ_SW_15M_START 18900
|
||||||
#define FREQ_SW_15M_END 19020
|
#define FREQ_SW_15M_END 19020
|
||||||
#define FREQ_SW_13M_START 21450
|
#define FREQ_SW_13M_START 21450
|
||||||
#define FREQ_SW_13M_END 21850
|
#define FREQ_SW_13M_END 21850
|
||||||
#define FREQ_SW_11M_START 25670
|
#define FREQ_SW_11M_START 25670
|
||||||
#define FREQ_SW_11M_END 26100
|
#define FREQ_SW_11M_END 26100
|
||||||
|
|
||||||
#define SW_MI_BAND_GAP 0
|
#define SW_MI_BAND_GAP 0
|
||||||
#define SW_MI_BAND_11M 11
|
#define SW_MI_BAND_11M 11
|
||||||
#define SW_MI_BAND_13M 13
|
#define SW_MI_BAND_13M 13
|
||||||
#define SW_MI_BAND_15M 15
|
#define SW_MI_BAND_15M 15
|
||||||
#define SW_MI_BAND_16M 16
|
#define SW_MI_BAND_16M 16
|
||||||
#define SW_MI_BAND_19M 19
|
#define SW_MI_BAND_19M 19
|
||||||
#define SW_MI_BAND_22M 22
|
#define SW_MI_BAND_22M 22
|
||||||
#define SW_MI_BAND_25M 25
|
#define SW_MI_BAND_25M 25
|
||||||
#define SW_MI_BAND_31M 31
|
#define SW_MI_BAND_31M 31
|
||||||
#define SW_MI_BAND_41M 41
|
#define SW_MI_BAND_41M 41
|
||||||
#define SW_MI_BAND_49M 49
|
#define SW_MI_BAND_49M 49
|
||||||
#define SW_MI_BAND_60M 60
|
#define SW_MI_BAND_60M 60
|
||||||
#define SW_MI_BAND_75M 75
|
#define SW_MI_BAND_75M 75
|
||||||
#define SW_MI_BAND_90M 90
|
#define SW_MI_BAND_90M 90
|
||||||
#define SW_MI_BAND_120M 120
|
#define SW_MI_BAND_120M 120
|
||||||
#define SW_MI_BAND_160M 160
|
#define SW_MI_BAND_160M 160
|
||||||
|
|
||||||
//MAIN COLORS /* RGB 565 CODES */
|
//MAIN COLORS /* RGB 565 CODES */
|
||||||
#define Black 0x0000 /* 0, 0, 0 */
|
#define Black 0x0000 /* 0, 0, 0 */
|
||||||
@@ -264,142 +255,14 @@
|
|||||||
#define ITEM9 190
|
#define ITEM9 190
|
||||||
#define ITEM10 210
|
#define ITEM10 210
|
||||||
|
|
||||||
// EEPROM index defines
|
|
||||||
#define EE_PRESETS_CNT 99 // When set > 99 change the complete EEPROM adressing!
|
|
||||||
#define EE_CHECKBYTE_VALUE 20 // 0 ~ 255,add new entry, change for new value
|
|
||||||
#define EE_PRESETS_FREQUENCY 0 // Default value when memory channel should be skipped!
|
|
||||||
#define EE_TOTAL_CNT 2287 // Total occupied eeprom bytes
|
|
||||||
|
|
||||||
#define EE_PRESETS_BAND_START 0 // 99 * 1 byte
|
|
||||||
#define EE_PRESET_BW_START 99 // 99 * 1 byte
|
|
||||||
#define EE_PRESET_MS_START 198 // 99 * 1 byte
|
|
||||||
#define EE_PRESETS_FREQUENCY_START 297 // 99 * 4 bytes
|
|
||||||
#define EE_PRESETS_RDSPI_START 693 // 99 * 5 bytes
|
|
||||||
#define EE_PRESETS_RDSPS_START 1188 // 99 * 9 bytes
|
|
||||||
|
|
||||||
#define EE_UINT16_FREQUENCY_FM 2079
|
|
||||||
#define EE_BYTE_VOLSET 2083
|
|
||||||
#define EE_BYTE_STEREO 2084
|
|
||||||
#define EE_BYTE_BANDFM 2085
|
|
||||||
#define EE_BYTE_BANDAM 2086
|
|
||||||
#define EE_UINT16_CONVERTERSET 2087
|
|
||||||
#define EE_UINT16_FMLOWEDGESET 2091
|
|
||||||
#define EE_UINT16_FMHIGHEDGESET 2095
|
|
||||||
#define EE_BYTE_CONTRASTSET 2099
|
|
||||||
#define EE_BYTE_STEREOLEVEL 2100
|
|
||||||
#define EE_BYTE_HIGHCUTLEVEL 2101
|
|
||||||
#define EE_BYTE_HIGHCUTOFFSET 2102
|
|
||||||
#define EE_BYTE_LEVELOFFSET 2103
|
|
||||||
#define EE_BYTE_RTBUFFER 2104
|
|
||||||
#define EE_BYTE_SORTAF 2105
|
|
||||||
#define EE_BYTE_STATIONLISTID 2106
|
|
||||||
#define EE_BYTE_EDGEBEEP 2107
|
|
||||||
#define EE_BYTE_SOFTMUTEAM 2108
|
|
||||||
#define EE_BYTE_SOFTMUTEFM 2109
|
|
||||||
#define EE_UINT16_FREQUENCY_AM 2110
|
|
||||||
#define EE_BYTE_LANGUAGE 2114
|
|
||||||
#define EE_BYTE_SHOWRDSERRORS 2115
|
|
||||||
#define EE_BYTE_TEF 2116
|
|
||||||
#define EE_BYTE_DISPLAYFLIP 2117
|
|
||||||
#define EE_BYTE_ROTARYMODE 2118
|
|
||||||
#define EE_BYTE_STEPSIZE 2119
|
|
||||||
#define EE_BYTE_TUNEMODE 2120
|
|
||||||
// empty byte
|
|
||||||
#define EE_BYTE_CHECKBYTE 2122
|
|
||||||
#define EE_BYTE_IMSSET 2123
|
|
||||||
#define EE_BYTE_EQSET 2124
|
|
||||||
#define EE_BYTE_BAND 2125
|
|
||||||
#define EE_BYTE_LOWLEVELSET 2126
|
|
||||||
#define EE_BYTE_BWSET_FM 2127
|
|
||||||
#define EE_BYTE_BWSET_AM 2128
|
|
||||||
#define EE_BYTE_BANDAUTOSW 2129
|
|
||||||
#define EE_BYTE_MEMORYPOS 2130
|
|
||||||
#define EE_BYTE_REGION 2131
|
|
||||||
#define EE_BYTE_RDS_UNDERSCORE 2132
|
|
||||||
#define EE_BYTE_USBMODE 2133
|
|
||||||
#define EE_BYTE_WIFI 2134
|
|
||||||
#define EE_BYTE_SUBNETCLIENT 2135
|
|
||||||
#define EE_BYTE_SHOWSWMIBAND 2136
|
|
||||||
#define EE_BYTE_RDS_FILTER 2137
|
|
||||||
#define EE_BYTE_RDS_PIERRORS 2138
|
|
||||||
#define EE_BYTE_USESQUELCH 2139
|
|
||||||
#define EE_BYTE_SHOWAUDIO 2140
|
|
||||||
#define EE_BYTE_AM_NB 2141
|
|
||||||
#define EE_BYTE_FM_NB 2142
|
|
||||||
#define EE_BYTE_AUDIOMODE 2143
|
|
||||||
#define EE_BYTE_TOUCH_ROTATING 2144
|
|
||||||
#define EE_BYTE_HARDWARE_MODEL 2145
|
|
||||||
#define EE_BYTE_POWEROPTIONS 2146
|
|
||||||
#define EE_BYTE_CURRENTTHEME 2147
|
|
||||||
#define EE_BYTE_FMDEFAULTSTEPSIZE 2148
|
|
||||||
#define EE_BYTE_SCREENSAVERSET 2149
|
|
||||||
#define EE_BYTE_UNIT 2150
|
|
||||||
#define EE_BYTE_AF 2151
|
|
||||||
#define EE_BYTE_BATTERY_OPTIONS 2152
|
|
||||||
#define EE_BYTE_AM_CO_DECT 2153
|
|
||||||
#define EE_BYTE_AM_CO_DECT_COUNT 2154
|
|
||||||
#define EE_BYTE_AM_RF_GAIN 2155
|
|
||||||
#define EE_BYTE_FM_DEEMPHASIS 2156
|
|
||||||
#define EE_UINT16_FREQUENCY_LW 2157
|
|
||||||
#define EE_UINT16_FREQUENCY_MW 2161
|
|
||||||
#define EE_UINT16_FREQUENCY_SW 2165
|
|
||||||
#define EE_UINT16_LOWEDGEOIRTSET 2169
|
|
||||||
#define EE_UINT16_HIGHEDGEOIRTSET 2173
|
|
||||||
#define EE_INT16_AMLEVELOFFSET 2177
|
|
||||||
#define EE_UINT16_FREQUENCY_OIRT 2181
|
|
||||||
#define EE_STRING_XDRGTK_KEY 2185 // 11 byte
|
|
||||||
#define EE_BYTE_FASTPS 2196
|
|
||||||
#define EE_BYTE_TOT 2197
|
|
||||||
#define EE_BYTE_MWREGION 2198
|
|
||||||
#define EE_BYTE_SPISPEED 2199
|
|
||||||
#define EE_BYTE_AMSCANSENS 2200
|
|
||||||
#define EE_BYTE_FMSCANSENS 2201
|
|
||||||
#define EE_BYTE_FREQFONT 2202
|
|
||||||
// Empty space, this was not used
|
|
||||||
#define EE_BYTE_XDRGTKMUTE 2204
|
|
||||||
#define EE_BYTE_FMAGC 2205
|
|
||||||
#define EE_BYTE_AMAGC 2206
|
|
||||||
#define EE_BYTE_FMSI 2207
|
|
||||||
#define EE_BYTE_SCANSTART 2208
|
|
||||||
#define EE_BYTE_SCANSTOP 2209
|
|
||||||
#define EE_BYTE_SCANHOLD 2210
|
|
||||||
#define EE_BYTE_SCANMEM 2211
|
|
||||||
#define EE_BYTE_SCANCANCEL 2212
|
|
||||||
#define EE_BYTE_SCANMUTE 2213
|
|
||||||
#define EE_BYTE_AUTOSQUELCH 2214
|
|
||||||
#define EE_BYTE_LONGBANDPRESS 2215
|
|
||||||
#define EE_BYTE_SHOWCLOCK 2216
|
|
||||||
#define EE_BYTE_SHOWLONGPS 2217
|
|
||||||
#define EE_UINT16_MEMSTARTFREQ 2218
|
|
||||||
#define EE_UINT16_MEMSTOPFREQ 2222
|
|
||||||
#define EE_BYTE_MEMSTARTPOS 2226
|
|
||||||
#define EE_BYTE_MEMSTOPPOS 2227
|
|
||||||
#define EE_BYTE_MEMPIONLY 2228
|
|
||||||
#define EE_BYTE_MEMDOUBLEPI 2229
|
|
||||||
// blank space
|
|
||||||
#define EE_BYTE_WAITONLYONSIGNAL 2253
|
|
||||||
#define EE_UINT16_CALTOUCH1 2254
|
|
||||||
#define EE_UINT16_CALTOUCH2 2258
|
|
||||||
#define EE_UINT16_CALTOUCH3 2262
|
|
||||||
#define EE_UINT16_CALTOUCH4 2266
|
|
||||||
#define EE_UINT16_CALTOUCH5 2270
|
|
||||||
#define EE_BYTE_INVERTDISPLAY 2274
|
|
||||||
#define EE_BYTE_TIMEZONE 2275
|
|
||||||
#define EE_BYTE_AUTOLOG 2276
|
|
||||||
#define EE_BYTE_AUTODST 2277
|
|
||||||
#define EE_BYTE_CLOCKAMPM 2278
|
|
||||||
#define EE_UINT16_LOGCOUNTER 2279
|
|
||||||
#define EE_UINT16_PICTLOCK 2283
|
|
||||||
// End of EEPROM index defines
|
|
||||||
|
|
||||||
// Memory channel database
|
// Memory channel database
|
||||||
typedef struct {
|
typedef struct {
|
||||||
byte bw;
|
byte bw;
|
||||||
byte band;
|
byte band;
|
||||||
bool ms;
|
bool ms;
|
||||||
unsigned int frequency;
|
unsigned int frequency;
|
||||||
char RDSPI[5];
|
char RDSPI[5];
|
||||||
char RDSPS[9];
|
char RDSPS[9];
|
||||||
} mem;
|
} mem;
|
||||||
|
|
||||||
enum LONGBANDBUTTONPRESS {
|
enum LONGBANDBUTTONPRESS {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "TEF6686.h"
|
#include "TEF6686.h"
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "change_detector.h"
|
#include "change_detector.h"
|
||||||
|
#include "nonvolatile.h"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#include <WiFiUdp.h>
|
#include <WiFiUdp.h>
|
||||||
@@ -261,6 +262,7 @@ extern String XDRGTK_key;
|
|||||||
extern Detector<String, 1> XDRGTKRDS;
|
extern Detector<String, 1> XDRGTKRDS;
|
||||||
extern uint16_t BW;
|
extern uint16_t BW;
|
||||||
extern uint16_t MStatus;
|
extern uint16_t MStatus;
|
||||||
|
extern bool modLevelForceRedraw;
|
||||||
extern uint16_t SWMIBandPos;
|
extern uint16_t SWMIBandPos;
|
||||||
extern uint16_t SWMIBandPosold;
|
extern uint16_t SWMIBandPosold;
|
||||||
extern uint16_t TouchCalData[5];
|
extern uint16_t TouchCalData[5];
|
||||||
|
|||||||
+128
-2
@@ -1,7 +1,133 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <EEPROM.h>
|
#include <EEPROM.h>
|
||||||
#include "globals.h"
|
|
||||||
#include "logbook.h"
|
// EEPROM index defines
|
||||||
|
#define EE_PRESETS_CNT 99 // When set > 99 change the complete EEPROM adressing!
|
||||||
|
#define EE_CHECKBYTE_VALUE 20 // 0 ~ 255,add new entry, change for new value
|
||||||
|
#define EE_PRESETS_FREQUENCY 0 // Default value when memory channel should be skipped!
|
||||||
|
#define EE_TOTAL_CNT 2287 // Total occupied eeprom bytes, we can take 20K
|
||||||
|
|
||||||
|
#define EE_PRESETS_BAND_START 0 // 99 * 1 byte
|
||||||
|
#define EE_PRESET_BW_START 99 // 99 * 1 byte
|
||||||
|
#define EE_PRESET_MS_START 198 // 99 * 1 byte
|
||||||
|
#define EE_PRESETS_FREQUENCY_START 297 // 99 * 4 bytes
|
||||||
|
#define EE_PRESETS_RDSPI_START 693 // 99 * 5 bytes
|
||||||
|
#define EE_PRESETS_RDSPS_START 1188 // 99 * 9 bytes
|
||||||
|
|
||||||
|
#define EE_UINT16_FREQUENCY_FM 2079
|
||||||
|
#define EE_BYTE_VOLSET 2083
|
||||||
|
#define EE_BYTE_STEREO 2084
|
||||||
|
#define EE_BYTE_BANDFM 2085
|
||||||
|
#define EE_BYTE_BANDAM 2086
|
||||||
|
#define EE_UINT16_CONVERTERSET 2087
|
||||||
|
#define EE_UINT16_FMLOWEDGESET 2091
|
||||||
|
#define EE_UINT16_FMHIGHEDGESET 2095
|
||||||
|
#define EE_BYTE_CONTRASTSET 2099
|
||||||
|
#define EE_BYTE_STEREOLEVEL 2100
|
||||||
|
#define EE_BYTE_HIGHCUTLEVEL 2101
|
||||||
|
#define EE_BYTE_HIGHCUTOFFSET 2102
|
||||||
|
#define EE_BYTE_LEVELOFFSET 2103
|
||||||
|
#define EE_BYTE_RTBUFFER 2104
|
||||||
|
#define EE_BYTE_SORTAF 2105
|
||||||
|
#define EE_BYTE_STATIONLISTID 2106
|
||||||
|
#define EE_BYTE_EDGEBEEP 2107
|
||||||
|
#define EE_BYTE_SOFTMUTEAM 2108
|
||||||
|
#define EE_BYTE_SOFTMUTEFM 2109
|
||||||
|
#define EE_UINT16_FREQUENCY_AM 2110
|
||||||
|
#define EE_BYTE_LANGUAGE 2114
|
||||||
|
#define EE_BYTE_SHOWRDSERRORS 2115
|
||||||
|
#define EE_BYTE_TEF 2116
|
||||||
|
#define EE_BYTE_DISPLAYFLIP 2117
|
||||||
|
#define EE_BYTE_ROTARYMODE 2118
|
||||||
|
#define EE_BYTE_STEPSIZE 2119
|
||||||
|
#define EE_BYTE_TUNEMODE 2120
|
||||||
|
// empty byte
|
||||||
|
#define EE_BYTE_CHECKBYTE 2122
|
||||||
|
#define EE_BYTE_IMSSET 2123
|
||||||
|
#define EE_BYTE_EQSET 2124
|
||||||
|
#define EE_BYTE_BAND 2125
|
||||||
|
#define EE_BYTE_LOWLEVELSET 2126
|
||||||
|
#define EE_BYTE_BWSET_FM 2127
|
||||||
|
#define EE_BYTE_BWSET_AM 2128
|
||||||
|
#define EE_BYTE_BANDAUTOSW 2129
|
||||||
|
#define EE_BYTE_MEMORYPOS 2130
|
||||||
|
#define EE_BYTE_REGION 2131
|
||||||
|
#define EE_BYTE_RDS_UNDERSCORE 2132
|
||||||
|
#define EE_BYTE_USBMODE 2133
|
||||||
|
#define EE_BYTE_WIFI 2134
|
||||||
|
#define EE_BYTE_SUBNETCLIENT 2135
|
||||||
|
#define EE_BYTE_SHOWSWMIBAND 2136
|
||||||
|
#define EE_BYTE_RDS_FILTER 2137
|
||||||
|
#define EE_BYTE_RDS_PIERRORS 2138
|
||||||
|
#define EE_BYTE_USESQUELCH 2139
|
||||||
|
#define EE_BYTE_SHOWAUDIO 2140
|
||||||
|
#define EE_BYTE_AM_NB 2141
|
||||||
|
#define EE_BYTE_FM_NB 2142
|
||||||
|
#define EE_BYTE_AUDIOMODE 2143
|
||||||
|
#define EE_BYTE_TOUCH_ROTATING 2144
|
||||||
|
#define EE_BYTE_HARDWARE_MODEL 2145
|
||||||
|
#define EE_BYTE_POWEROPTIONS 2146
|
||||||
|
#define EE_BYTE_CURRENTTHEME 2147
|
||||||
|
#define EE_BYTE_FMDEFAULTSTEPSIZE 2148
|
||||||
|
#define EE_BYTE_SCREENSAVERSET 2149
|
||||||
|
#define EE_BYTE_UNIT 2150
|
||||||
|
#define EE_BYTE_AF 2151
|
||||||
|
#define EE_BYTE_BATTERY_OPTIONS 2152
|
||||||
|
#define EE_BYTE_AM_CO_DECT 2153
|
||||||
|
#define EE_BYTE_AM_CO_DECT_COUNT 2154
|
||||||
|
#define EE_BYTE_AM_RF_GAIN 2155
|
||||||
|
#define EE_BYTE_FM_DEEMPHASIS 2156
|
||||||
|
#define EE_UINT16_FREQUENCY_LW 2157
|
||||||
|
#define EE_UINT16_FREQUENCY_MW 2161
|
||||||
|
#define EE_UINT16_FREQUENCY_SW 2165
|
||||||
|
#define EE_UINT16_LOWEDGEOIRTSET 2169
|
||||||
|
#define EE_UINT16_HIGHEDGEOIRTSET 2173
|
||||||
|
#define EE_INT16_AMLEVELOFFSET 2177
|
||||||
|
#define EE_UINT16_FREQUENCY_OIRT 2181
|
||||||
|
#define EE_STRING_XDRGTK_KEY 2185 // 11 byte
|
||||||
|
#define EE_BYTE_FASTPS 2196
|
||||||
|
#define EE_BYTE_TOT 2197
|
||||||
|
#define EE_BYTE_MWREGION 2198
|
||||||
|
#define EE_BYTE_SPISPEED 2199
|
||||||
|
#define EE_BYTE_AMSCANSENS 2200
|
||||||
|
#define EE_BYTE_FMSCANSENS 2201
|
||||||
|
#define EE_BYTE_FREQFONT 2202
|
||||||
|
// Empty space, this was not used
|
||||||
|
#define EE_BYTE_XDRGTKMUTE 2204
|
||||||
|
#define EE_BYTE_FMAGC 2205
|
||||||
|
#define EE_BYTE_AMAGC 2206
|
||||||
|
#define EE_BYTE_FMSI 2207
|
||||||
|
#define EE_BYTE_SCANSTART 2208
|
||||||
|
#define EE_BYTE_SCANSTOP 2209
|
||||||
|
#define EE_BYTE_SCANHOLD 2210
|
||||||
|
#define EE_BYTE_SCANMEM 2211
|
||||||
|
#define EE_BYTE_SCANCANCEL 2212
|
||||||
|
#define EE_BYTE_SCANMUTE 2213
|
||||||
|
#define EE_BYTE_AUTOSQUELCH 2214
|
||||||
|
#define EE_BYTE_LONGBANDPRESS 2215
|
||||||
|
#define EE_BYTE_SHOWCLOCK 2216
|
||||||
|
#define EE_BYTE_SHOWLONGPS 2217
|
||||||
|
#define EE_UINT16_MEMSTARTFREQ 2218
|
||||||
|
#define EE_UINT16_MEMSTOPFREQ 2222
|
||||||
|
#define EE_BYTE_MEMSTARTPOS 2226
|
||||||
|
#define EE_BYTE_MEMSTOPPOS 2227
|
||||||
|
#define EE_BYTE_MEMPIONLY 2228
|
||||||
|
#define EE_BYTE_MEMDOUBLEPI 2229
|
||||||
|
// blank space
|
||||||
|
#define EE_BYTE_WAITONLYONSIGNAL 2253
|
||||||
|
#define EE_UINT16_CALTOUCH1 2254
|
||||||
|
#define EE_UINT16_CALTOUCH2 2258
|
||||||
|
#define EE_UINT16_CALTOUCH3 2262
|
||||||
|
#define EE_UINT16_CALTOUCH4 2266
|
||||||
|
#define EE_UINT16_CALTOUCH5 2270
|
||||||
|
#define EE_BYTE_INVERTDISPLAY 2274
|
||||||
|
#define EE_BYTE_TIMEZONE 2275
|
||||||
|
#define EE_BYTE_AUTOLOG 2276
|
||||||
|
#define EE_BYTE_AUTODST 2277
|
||||||
|
#define EE_BYTE_CLOCKAMPM 2278
|
||||||
|
#define EE_UINT16_LOGCOUNTER 2279
|
||||||
|
#define EE_UINT16_PICTLOCK 2283
|
||||||
|
// End of EEPROM index defines
|
||||||
|
|
||||||
void StoreFrequency();
|
void StoreFrequency();
|
||||||
void ClearMemoryRange(uint8_t start, uint8_t stop);
|
void ClearMemoryRange(uint8_t start, uint8_t stop);
|
||||||
|
|||||||
+1
-1
@@ -356,7 +356,7 @@ void TEF6686::getStatus(int16_t *level, uint16_t *USN, uint16_t *WAM, int16_t *o
|
|||||||
|
|
||||||
void TEF6686::getStatusAM(int16_t *level, uint16_t *noise, uint16_t *cochannel, int16_t *offset, uint16_t *bandwidth, uint16_t *audiolevel, int8_t *snr) {
|
void TEF6686::getStatusAM(int16_t *level, uint16_t *noise, uint16_t *cochannel, int16_t *offset, uint16_t *bandwidth, uint16_t *audiolevel, int8_t *snr) {
|
||||||
uint8_t buf[14];
|
uint8_t buf[14];
|
||||||
devTEF_Get_Cmd(TEF_AM, Cmd_Get_Quality_Data, buf, sizeof(buf));
|
devTEF_Get_Cmd(TEF_AM, Cmd_Get_Quality_Status, buf, sizeof(buf));
|
||||||
if(level != NULL) *level = Convert8bto16b(buf + 2);
|
if(level != NULL) *level = Convert8bto16b(buf + 2);
|
||||||
if(noise != NULL) *noise = Convert8bto16b(buf + 4);
|
if(noise != NULL) *noise = Convert8bto16b(buf + 4);
|
||||||
if(cochannel != NULL) *cochannel = Convert8bto16b(buf + 6);
|
if(cochannel != NULL) *cochannel = Convert8bto16b(buf + 6);
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ uint8_t devTEF_APPL_Get_Operation_Status() {
|
|||||||
|
|
||||||
void devTEF_Radio_Get_Quality_Status(uint16_t *status, int16_t *level, uint16_t *usn, uint16_t *wam, int16_t *offset, uint16_t *bandwidth, uint16_t *audiolevel, int8_t *snr) {
|
void devTEF_Radio_Get_Quality_Status(uint16_t *status, int16_t *level, uint16_t *usn, uint16_t *wam, int16_t *offset, uint16_t *bandwidth, uint16_t *audiolevel, int8_t *snr) {
|
||||||
uint8_t buf[14];
|
uint8_t buf[14];
|
||||||
devTEF_Get_Cmd(TEF_FM, Cmd_Get_Quality_Data, buf, sizeof(buf));
|
devTEF_Get_Cmd(TEF_FM, Cmd_Get_Quality_Status, buf, sizeof(buf));
|
||||||
if(status != NULL) *status = Convert8bto16b(buf);
|
if(status != NULL) *status = Convert8bto16b(buf);
|
||||||
if(level != NULL) *level = Convert8bto16b(buf + 2);
|
if(level != NULL) *level = Convert8bto16b(buf + 2);
|
||||||
if(usn != NULL) *usn = Convert8bto16b(buf + 4);
|
if(usn != NULL) *usn = Convert8bto16b(buf + 4);
|
||||||
|
|||||||
+3
-2
@@ -15,6 +15,7 @@ using fs::FS;
|
|||||||
#include "system_console.h"
|
#include "system_console.h"
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
#include "logbook.h"
|
||||||
|
|
||||||
Console console(&tft);
|
Console console(&tft);
|
||||||
RTC_DATA_ATTR bool gpio_chip = false;
|
RTC_DATA_ATTR bool gpio_chip = false;
|
||||||
@@ -1646,7 +1647,7 @@ void KeyUp() {
|
|||||||
case TUNE_MI_BAND:
|
case TUNE_MI_BAND:
|
||||||
if (showSWMIBand) {
|
if (showSWMIBand) {
|
||||||
if (displayflip) ToggleSWMIBand(true);
|
if (displayflip) ToggleSWMIBand(true);
|
||||||
else ToggleSWMIBand(REVERSE);
|
else ToggleSWMIBand(false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1704,7 +1705,7 @@ void KeyDown() {
|
|||||||
break;
|
break;
|
||||||
case TUNE_MI_BAND:
|
case TUNE_MI_BAND:
|
||||||
if (showSWMIBand) {
|
if (showSWMIBand) {
|
||||||
if (displayflip) ToggleSWMIBand(REVERSE);
|
if (displayflip) ToggleSWMIBand(false);
|
||||||
else ToggleSWMIBand(true);
|
else ToggleSWMIBand(true);
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -249,6 +249,7 @@ String XDRGTK_key;
|
|||||||
Detector<String, 1> XDRGTKRDS{""};
|
Detector<String, 1> XDRGTKRDS{""};
|
||||||
uint16_t BW;
|
uint16_t BW;
|
||||||
uint16_t MStatus;
|
uint16_t MStatus;
|
||||||
|
bool modLevelForceRedraw = true;
|
||||||
uint16_t SWMIBandPos;
|
uint16_t SWMIBandPos;
|
||||||
uint16_t SWMIBandPosold;
|
uint16_t SWMIBandPosold;
|
||||||
uint16_t TouchCalData[5];
|
uint16_t TouchCalData[5];
|
||||||
|
|||||||
+3
-2
@@ -2996,6 +2996,7 @@ void BuildDisplay() {
|
|||||||
rdsstatscreen = false;
|
rdsstatscreen = false;
|
||||||
advancedRDS = false;
|
advancedRDS = false;
|
||||||
BWtune = false;
|
BWtune = false;
|
||||||
|
modLevelForceRedraw = true;
|
||||||
|
|
||||||
tft.fillScreen(BackgroundColor);
|
tft.fillScreen(BackgroundColor);
|
||||||
tft.drawRect(0, 0, 320, 240, FrameColor);
|
tft.drawRect(0, 0, 320, 240, FrameColor);
|
||||||
@@ -3116,8 +3117,8 @@ void BuildDisplay() {
|
|||||||
radio.rds.hasTMC.call();
|
radio.rds.hasTMC.call();
|
||||||
radio.rds.hasCT.call();
|
radio.rds.hasCT.call();
|
||||||
radio.rds.hasRTplus.call();
|
radio.rds.hasRTplus.call();
|
||||||
MPold = 99;
|
MPold = 100;
|
||||||
USold = 99;
|
USold = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuUpDown(bool dir) {
|
void MenuUpDown(bool dir) {
|
||||||
|
|||||||
+44
-35
@@ -11,12 +11,15 @@
|
|||||||
#include "FREQFONT.h"
|
#include "FREQFONT.h"
|
||||||
#include "touch.h"
|
#include "touch.h"
|
||||||
#include "rds.h"
|
#include "rds.h"
|
||||||
|
#include "logbook.h"
|
||||||
|
#include "comms.h"
|
||||||
|
|
||||||
void Touch_IRQ_Handler() {
|
void Touch_IRQ_Handler() {
|
||||||
touch_detect = true;
|
touch_detect = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void read_encoder() {
|
void read_encoder() {
|
||||||
|
if(i2c_pc_control) return;
|
||||||
if (!digitalRead(ROTARY_PIN_A) || !digitalRead(ROTARY_PIN_B)) {
|
if (!digitalRead(ROTARY_PIN_A) || !digitalRead(ROTARY_PIN_B)) {
|
||||||
uint32_t dt = millis() - rotarytimer;
|
uint32_t dt = millis() - rotarytimer;
|
||||||
if (dt >= 45) {
|
if (dt >= 45) {
|
||||||
@@ -182,16 +185,8 @@ void later_setup_periph() {
|
|||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);
|
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);
|
||||||
gpio_set_drive_capability((gpio_num_t)5, GPIO_DRIVE_CAP_0);
|
|
||||||
gpio_set_drive_capability((gpio_num_t)16, GPIO_DRIVE_CAP_0);
|
|
||||||
gpio_set_drive_capability((gpio_num_t)17, GPIO_DRIVE_CAP_0);
|
|
||||||
gpio_set_drive_capability((gpio_num_t)18, GPIO_DRIVE_CAP_0);
|
|
||||||
gpio_set_drive_capability((gpio_num_t)19, GPIO_DRIVE_CAP_0);
|
|
||||||
gpio_set_drive_capability((gpio_num_t)21, GPIO_DRIVE_CAP_0);
|
|
||||||
gpio_set_drive_capability((gpio_num_t)22, GPIO_DRIVE_CAP_0);
|
|
||||||
gpio_set_drive_capability((gpio_num_t)23, GPIO_DRIVE_CAP_0);
|
|
||||||
|
|
||||||
analogWriteFrequency(5000);
|
analogWriteFrequency(6700); // six seven
|
||||||
|
|
||||||
EEPROM.begin(EE_TOTAL_CNT);
|
EEPROM.begin(EE_TOTAL_CNT);
|
||||||
|
|
||||||
@@ -452,8 +447,6 @@ void setup() {
|
|||||||
console.reset();
|
console.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "comms.h"
|
|
||||||
|
|
||||||
void handleWiFi() {
|
void handleWiFi() {
|
||||||
if (wifi && !menu) {
|
if (wifi && !menu) {
|
||||||
webserver.handleClient();
|
webserver.handleClient();
|
||||||
@@ -530,26 +523,39 @@ void ShowAudioLevel() {
|
|||||||
|
|
||||||
peakholdold = constrain(peakholdold, 0, 86);
|
peakholdold = constrain(peakholdold, 0, 86);
|
||||||
|
|
||||||
HSV hsv1 = RGB565toHSV(ModBarInsignificantColor);
|
// Skip redraw when nothing changed
|
||||||
HSV hsv2 = RGB565toHSV(ModBarSignificantColor);
|
static int prevDisplayedSegments = -1;
|
||||||
|
static int prevPeakhold = -1;
|
||||||
|
if (!modLevelForceRedraw && DisplayedSegments == prevDisplayedSegments && peakholdold == prevPeakhold) return;
|
||||||
|
modLevelForceRedraw = false;
|
||||||
|
|
||||||
int gradientStart = (86 * 25) / 100;
|
// Pre-computed gradient color lookup table (cached, recomputed only on theme change)
|
||||||
int gradientEnd = (86 * 60) / 100;
|
static uint16_t modGradient[87];
|
||||||
|
static uint16_t cachedInsigColor = 0;
|
||||||
|
static uint16_t cachedSigColor = 0;
|
||||||
|
static bool gradientReady = false;
|
||||||
|
|
||||||
for (int i = 0; i < min(DisplayedSegments, gradientStart); i++) tft.fillRect(16 + 2 * i, 133, 2, 6, ModBarInsignificantColor);
|
if (!gradientReady || cachedInsigColor != ModBarInsignificantColor || cachedSigColor != ModBarSignificantColor) {
|
||||||
|
HSV hsv1 = RGB565toHSV(ModBarInsignificantColor);
|
||||||
if (DisplayedSegments > gradientStart) {
|
HSV hsv2 = RGB565toHSV(ModBarSignificantColor);
|
||||||
for (int i = gradientStart; i < min(DisplayedSegments, gradientEnd); i++) {
|
int gStart = (86 * 25) / 100;
|
||||||
float h = map(i, gradientStart, gradientEnd, hsv1.h, hsv2.h);
|
int gEnd = (86 * 60) / 100;
|
||||||
float s = map(i, gradientStart, gradientEnd, hsv1.s * 100, hsv2.s * 100) / 100.0;
|
for (int i = 0; i < 87; i++) {
|
||||||
float v = map(i, gradientStart, gradientEnd, hsv1.v * 100, hsv2.v * 100) / 100.0;
|
if (i < gStart) modGradient[i] = ModBarInsignificantColor;
|
||||||
tft.fillRect(16 + 2 * i, 133, 2, 6, HSVtoRGB565(h, s, v));
|
else if (i < gEnd) {
|
||||||
|
float h = map(i, gStart, gEnd, hsv1.h, hsv2.h);
|
||||||
|
float s = map(i, gStart, gEnd, hsv1.s * 100, hsv2.s * 100) / 100.0;
|
||||||
|
float v = map(i, gStart, gEnd, hsv1.v * 100, hsv2.v * 100) / 100.0;
|
||||||
|
modGradient[i] = HSVtoRGB565(h, s, v);
|
||||||
|
} else modGradient[i] = ModBarSignificantColor;
|
||||||
}
|
}
|
||||||
|
cachedInsigColor = ModBarInsignificantColor;
|
||||||
|
cachedSigColor = ModBarSignificantColor;
|
||||||
|
gradientReady = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DisplayedSegments > gradientEnd) {
|
// Draw bar segments using cached gradient colors
|
||||||
for (int i = gradientEnd; i < DisplayedSegments; i++) tft.fillRect(16 + 2 * i, 133, 2, 6, ModBarSignificantColor);
|
for (int i = 0; i < DisplayedSegments; i++) tft.fillRect(16 + 2 * i, 133, 2, 6, modGradient[i]);
|
||||||
}
|
|
||||||
|
|
||||||
int greyStart = 16 + 2 * DisplayedSegments;
|
int greyStart = 16 + 2 * DisplayedSegments;
|
||||||
int greyWidth = 2 * (87 - DisplayedSegments);
|
int greyWidth = 2 * (87 - DisplayedSegments);
|
||||||
@@ -559,6 +565,9 @@ void ShowAudioLevel() {
|
|||||||
tft.fillRect(peakHoldPosition, 133, 2, 6, (MStatus > 80) ? ModBarSignificantColor : PrimaryColor);
|
tft.fillRect(peakHoldPosition, 133, 2, 6, (MStatus > 80) ? ModBarSignificantColor : PrimaryColor);
|
||||||
|
|
||||||
if (millis() - peakholdmillis >= 1000 && (peakholdold <= DisplayedSegments || peakholdold >= 86)) tft.fillRect(peakHoldPosition, 133, 2, 6, GreyoutColor);
|
if (millis() - peakholdmillis >= 1000 && (peakholdold <= DisplayedSegments || peakholdold >= 86)) tft.fillRect(peakHoldPosition, 133, 2, 6, GreyoutColor);
|
||||||
|
|
||||||
|
prevDisplayedSegments = DisplayedSegments;
|
||||||
|
prevPeakhold = peakholdold;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -948,7 +957,7 @@ void ShowBattery() {
|
|||||||
else return;
|
else return;
|
||||||
|
|
||||||
float v = analogReadMilliVolts(BATTERY_PIN) * 0.002; // 0.002 converts to volts plus corrects the /2 voltage divider
|
float v = analogReadMilliVolts(BATTERY_PIN) * 0.002; // 0.002 converts to volts plus corrects the /2 voltage divider
|
||||||
byte battery = map(constrain(v, BATTERY_LOW_VALUE, BATTERY_FULL_VALUE), BATTERY_LOW_VALUE, BATTERY_FULL_VALUE, 0, BAT_LEVEL_STAGE);
|
byte battery = map(constrain(v, BATTERY_LOW_VALUE, BATTERY_FULL_VALUE), BATTERY_LOW_VALUE, BATTERY_FULL_VALUE, 0, 32);
|
||||||
byte batteryprobe = map(constrain(v, BATTERY_LOW_VALUE, BATTERY_FULL_VALUE), BATTERY_LOW_VALUE, BATTERY_FULL_VALUE, 0, 50);
|
byte batteryprobe = map(constrain(v, BATTERY_LOW_VALUE, BATTERY_FULL_VALUE), BATTERY_LOW_VALUE, BATTERY_FULL_VALUE, 0, 50);
|
||||||
if (batteryold != batteryprobe) {
|
if (batteryold != batteryprobe) {
|
||||||
if (batterydetect) {
|
if (batterydetect) {
|
||||||
@@ -962,7 +971,7 @@ void ShowBattery() {
|
|||||||
|
|
||||||
if (batteryoptions != BATTERY_VALUE && batteryoptions != BATTERY_PERCENT && battery != 0) {
|
if (batteryoptions != BATTERY_VALUE && batteryoptions != BATTERY_PERCENT && battery != 0) {
|
||||||
if(v > BATTERY_FULL_VALUE) tft.fillRoundRect(279, 8, 32, 16, 2, ActiveColor);
|
if(v > BATTERY_FULL_VALUE) tft.fillRoundRect(279, 8, 32, 16, 2, ActiveColor);
|
||||||
else tft.fillRoundRect(279, 8, battery * 8, 16, 2, SecondaryColor);
|
else tft.fillRoundRect(279, 8, battery, 16, 2, SecondaryColor);
|
||||||
} else tft.fillRoundRect(279, 8, 32, 16, 2, BackgroundColor);
|
} else tft.fillRoundRect(279, 8, 32, 16, 2, BackgroundColor);
|
||||||
}
|
}
|
||||||
batteryold = batteryprobe;
|
batteryold = batteryprobe;
|
||||||
@@ -1359,7 +1368,7 @@ void loop() {
|
|||||||
if (screensavertriggered) {
|
if (screensavertriggered) {
|
||||||
if (!touchrotating) {
|
if (!touchrotating) {
|
||||||
rotary = 0;
|
rotary = 0;
|
||||||
WakeToSleep(REVERSE);
|
WakeToSleep(false);
|
||||||
} else {
|
} else {
|
||||||
if (BWtune) doBWtuneUp(); else KeyUp();
|
if (BWtune) doBWtuneUp(); else KeyUp();
|
||||||
}
|
}
|
||||||
@@ -1378,7 +1387,7 @@ void loop() {
|
|||||||
if (screensavertriggered) {
|
if (screensavertriggered) {
|
||||||
if (!touchrotating) {
|
if (!touchrotating) {
|
||||||
rotary = 0;
|
rotary = 0;
|
||||||
WakeToSleep(REVERSE);
|
WakeToSleep(false);
|
||||||
} else {
|
} else {
|
||||||
if (BWtune) doBWtuneDown(); else KeyDown();
|
if (BWtune) doBWtuneDown(); else KeyDown();
|
||||||
}
|
}
|
||||||
@@ -1395,7 +1404,7 @@ void loop() {
|
|||||||
if (digitalRead(BANDBUTTON) == LOW) {
|
if (digitalRead(BANDBUTTON) == LOW) {
|
||||||
tottimer = millis();
|
tottimer = millis();
|
||||||
if (screensavertriggered) {
|
if (screensavertriggered) {
|
||||||
WakeToSleep(REVERSE);
|
WakeToSleep(false);
|
||||||
while (digitalRead(BANDBUTTON) == LOW);
|
while (digitalRead(BANDBUTTON) == LOW);
|
||||||
} else BANDBUTTONPress();
|
} else BANDBUTTONPress();
|
||||||
}
|
}
|
||||||
@@ -1403,7 +1412,7 @@ void loop() {
|
|||||||
if (digitalRead(ROTARY_BUTTON) == LOW) {
|
if (digitalRead(ROTARY_BUTTON) == LOW) {
|
||||||
tottimer = millis();
|
tottimer = millis();
|
||||||
if (screensavertriggered) {
|
if (screensavertriggered) {
|
||||||
WakeToSleep(REVERSE);
|
WakeToSleep(false);
|
||||||
while (digitalRead(ROTARY_BUTTON) == LOW);
|
while (digitalRead(ROTARY_BUTTON) == LOW);
|
||||||
} else if (!afscreen && !rdsstatscreen) ButtonPress();
|
} else if (!afscreen && !rdsstatscreen) ButtonPress();
|
||||||
}
|
}
|
||||||
@@ -1411,7 +1420,7 @@ void loop() {
|
|||||||
if (digitalRead(MODEBUTTON) == LOW) {
|
if (digitalRead(MODEBUTTON) == LOW) {
|
||||||
tottimer = millis();
|
tottimer = millis();
|
||||||
if (screensavertriggered) {
|
if (screensavertriggered) {
|
||||||
WakeToSleep(REVERSE);
|
WakeToSleep(false);
|
||||||
while (digitalRead(MODEBUTTON) == LOW);
|
while (digitalRead(MODEBUTTON) == LOW);
|
||||||
} else if(!screenmute) ModeButtonPress();
|
} else if(!screenmute) ModeButtonPress();
|
||||||
}
|
}
|
||||||
@@ -1419,13 +1428,13 @@ void loop() {
|
|||||||
if (digitalRead(BWBUTTON) == LOW && !BWtune) {
|
if (digitalRead(BWBUTTON) == LOW && !BWtune) {
|
||||||
tottimer = millis();
|
tottimer = millis();
|
||||||
if (screensavertriggered) {
|
if (screensavertriggered) {
|
||||||
WakeToSleep(REVERSE);
|
WakeToSleep(false);
|
||||||
while (digitalRead(BWBUTTON) == LOW);
|
while (digitalRead(BWBUTTON) == LOW);
|
||||||
} else if(!screenmute) BWButtonPress();
|
} else if(!screenmute) BWButtonPress();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (digitalRead(EXT_IRQ) == LOW) {
|
if (digitalRead(EXT_IRQ) == LOW) {
|
||||||
if (screensavertriggered) WakeToSleep(REVERSE);
|
if (screensavertriggered) WakeToSleep(false);
|
||||||
int num = GetNum();
|
int num = GetNum();
|
||||||
if (!screenmute && !BWtune && !menu && !advancedRDS && !rdsstatscreen && !afscreen && num != -1) NumpadProcess(num);
|
if (!screenmute && !BWtune && !menu && !advancedRDS && !rdsstatscreen && !afscreen && num != -1) NumpadProcess(num);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
#include "nonvolatile.h"
|
#include "nonvolatile.h"
|
||||||
|
#include "globals.h"
|
||||||
|
#include "logbook.h"
|
||||||
|
|
||||||
void StoreFrequency() {
|
void StoreFrequency() {
|
||||||
switch (band) {
|
switch (band) {
|
||||||
|
|||||||
+1
-3
@@ -491,9 +491,7 @@ void showCT() {
|
|||||||
time_t t = rtc.getEpoch();
|
time_t t = rtc.getEpoch();
|
||||||
|
|
||||||
t += Timezone * 3600; // Convert offset from hours to seconds
|
t += Timezone * 3600; // Convert offset from hours to seconds
|
||||||
if (NTPupdated) {
|
if (autoDST && isDST(t)) t += 3600;
|
||||||
if (autoDST && isDST(t)) t += 3600;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto localtm = localtime(&t);
|
auto localtm = localtime(&t);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user