Skip to content

Commit

Permalink
Merge branch 'master' into Auto-band-v2
Browse files Browse the repository at this point in the history
Conflicts:
	README.md
  • Loading branch information
camilstaps committed May 16, 2017
2 parents 1197d0a + e7270cf commit 775e0df
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 22 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ uploading the code to the chip.
- `TUNING_STEP_DIGITS`: which digit to blink when in a tuning step. An array of
the same length as `TUNING_STEPS`. Values should be taken from `BLINK_NONE`,
`BLINK_0`, `_1`, `_2` and `_3` (`0` is the rightmost digit).
- There are several band plans. Define one of `PLAN_IARU1`, `_IARU2`, `_IARU3`.
- There are several band plans. Define one of `PLAN_IARU1`, `_IARU2`, `_IARU3`,
`_VK`.
The exact boundary definitions are in `bands.h`.
- Change the default operating frequency of a band by defining e.g.

Expand Down Expand Up @@ -211,6 +212,8 @@ Some images of the connections:

- 2017-05-16:
- `OPT_AUTO_BAND` (PR [#22](/../../pull/22) by VK3IL)
- 2017-05-12:
- VK band plans (PR [#21](/../../pull/21) by VK3IL)
- 2017-05-04:
- Beacon mode (issue [#6](/../../issues/6))
- More logical UX for sending and storing memories, using RIT to cancel
Expand Down
39 changes: 19 additions & 20 deletions SODA_POP/SODA_POP.ino
Original file line number Diff line number Diff line change
Expand Up @@ -985,26 +985,13 @@ void calibration_set_correction()
*/
void fetch_calibration_data()
{
unsigned long temp = 0;

temp = EEPROM.read(3);
IFfreq = IFfreq+temp;
IFfreq = IFfreq << 8;
temp = EEPROM.read(2);
IFfreq = IFfreq + temp;
IFfreq = IFfreq << 8;
temp = EEPROM.read(1);
IFfreq = IFfreq + temp;
IFfreq = IFfreq << 8;
temp = EEPROM.read(0);
IFfreq = IFfreq + temp;

temp = 0;
temp = EEPROM.read(5);
cal_value = temp;
cal_value = cal_value <<8;
temp = EEPROM.read(4);
cal_value = cal_value + temp;
IFfreq = EEPROM.read(3);
IFfreq = (IFfreq << 8) + EEPROM.read(2);
IFfreq = (IFfreq << 8) + EEPROM.read(1);
IFfreq = (IFfreq << 8) + EEPROM.read(0);

cal_value = EEPROM.read(5);
cal_value = (cal_value << 8) + EEPROM.read(4);
}

/**
Expand Down Expand Up @@ -1040,6 +1027,18 @@ void freq_adjust(long step)
*/
void fix_op_freq()
{
#ifdef PLAN_VK
if (state.band == BAND_80) {
if (state.op_freq > BAND_80_LOW_TOP && state.op_freq < BAND_80_GAP_MIDDLE){
state.op_freq = BAND_80_HIGH_BOTTOM;
return;
}
else if (state.op_freq < BAND_80_HIGH_BOTTOM && state.op_freq > BAND_80_GAP_MIDDLE) {
state.op_freq = BAND_80_LOW_TOP;
return;
}
}
#endif
if (state.op_freq > BAND_LIMITS_HIGH[state.band])
state.op_freq = BAND_LIMITS_HIGH[state.band];
if (state.op_freq < BAND_LIMITS_LOW[state.band])
Expand Down
75 changes: 74 additions & 1 deletion SODA_POP/bands.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,84 @@ const unsigned long BAND_OP_FREQS[] =
, DEFAULT_OP_FREQ_10
};
#else /* End of PLAN_IARU3 */
#ifdef PLAN_VK
enum band : unsigned char {
BAND_160, BAND_80, BAND_40, BAND_30, BAND_20,
BAND_17, BAND_15, BAND_12, BAND_10,
LAST_BAND, BAND_UNKNOWN = 0xff
};
const unsigned char BAND_DIGITS_2[] = {1,8,4,3,2,1,1,1,1};
const unsigned char BAND_DIGITS_1[] = {6,0,0,0,0,7,5,2,0};
# ifndef DEFAULT_OP_FREQ_160
# define DEFAULT_OP_FREQ_160 183200000
# endif
# ifndef DEFAULT_OP_FREQ_80
# define DEFAULT_OP_FREQ_80 353200000
# endif
# ifndef DEFAULT_OP_FREQ_40
# define DEFAULT_OP_FREQ_40 703200000
# endif
# ifndef DEFAULT_OP_FREQ_30
# define DEFAULT_OP_FREQ_30 1011600000
# endif
# ifndef DEFAULT_OP_FREQ_20
# define DEFAULT_OP_FREQ_20 1406200000
# endif
# ifndef DEFAULT_OP_FREQ_17
# define DEFAULT_OP_FREQ_17 1808600000
# endif
# ifndef DEFAULT_OP_FREQ_15
# define DEFAULT_OP_FREQ_15 2106200000u
# endif
# ifndef DEFAULT_OP_FREQ_12
# define DEFAULT_OP_FREQ_12 2490800000u
# endif
# ifndef DEFAULT_OP_FREQ_10
# define DEFAULT_OP_FREQ_10 2806200000u
# endif
const unsigned long BAND_LIMITS_LOW[] =
{ 180000000
, 350000000
, 700000000
, 1010000000
, 1400000000
, 1806800000
, 2100000000u
, 2489000000u
, 2800000000u
};
const unsigned long BAND_LIMITS_HIGH[] =
{ 187500000
, 380000000
, 730000000
, 1015000000
, 1435000000
, 1816800000
, 2145000000u
, 2499000000u
, 2970000000u
};
// Special definitions to support gapped 80m band in VK
#define BAND_80_LOW_TOP 370000000
#define BAND_80_HIGH_BOTTOM 377600000
#define BAND_80_GAP_MIDDLE (BAND_80_LOW_TOP+BAND_80_HIGH_BOTTOM)/2
const unsigned long BAND_OP_FREQS[] =
{ DEFAULT_OP_FREQ_160
, DEFAULT_OP_FREQ_80
, DEFAULT_OP_FREQ_40
, DEFAULT_OP_FREQ_30
, DEFAULT_OP_FREQ_20
, DEFAULT_OP_FREQ_17
, DEFAULT_OP_FREQ_15
, DEFAULT_OP_FREQ_12
, DEFAULT_OP_FREQ_10
};
#else /* End of PLAN_VK */
#error Please select a band plan using #define PLAN_...
#endif
#endif
#endif

#endif

#endif
// vim: tabstop=2 shiftwidth=2 expandtab:

0 comments on commit 775e0df

Please sign in to comment.