Skip to content

Commit

Permalink
First cut at clock setting for IC7300/7800/785x/9700
Browse files Browse the repository at this point in the history
  • Loading branch information
mdblack98 committed Dec 1, 2021
1 parent a36b74d commit a1c8493
Show file tree
Hide file tree
Showing 12 changed files with 495 additions and 8 deletions.
4 changes: 3 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ Copyright (C) 2000-2021 Michael Black W9MDB, and others
Please send Hamlib bug reports to hamlib-developer@lists.sourceforge.net

Version 4.4
* 2021-??-??
* 2021-12-01
* Icom rigs now default filter 2 when setting PKTUSB but user can override
* Fix FTDX9000 meter readings
* Add Android sensor as a rotator
* Added rig_get_vfo to some Icom rigs that have XCHG or 0x25 command capability
* Added ability to build hamlib with docker
* Added M0NKA mcHF URP rig
* Faster serial i/o noticeable on higher baud rates
* IC7300 set_clock/get_clock routines added -- no auto set yet

Version 4.3.1
* 2021-09-14
Expand Down
2 changes: 1 addition & 1 deletion cppcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ CHECK="\
if test $# -eq 0 ; then
echo "See cppcheck.log when done"
echo "This takes a while to run"
cppcheck --inline-suppr \
strace -f cppcheck --inline-suppr \
-I src \
-I include \
--include=include/config.h \
Expand Down
24 changes: 24 additions & 0 deletions doc/man1/rigctl.1
Original file line number Diff line number Diff line change
Expand Up @@ -1136,6 +1136,30 @@ option above, will terminate each command string sent to the radio. This
character should not be a part of the input string.
.
.TP
.BR set_clock " \(aq" \fIDateTime\fP \(aq
Set
.RI \(aq DateTime \(aq
.IP
Sets rig clock -- note that some rigs do not handle seconds or milliseconds.
If you try to set sec/msec and rig does not support it you will get a debug warning message.
Format is ISO8601,
.EX
Formats accepted
YYYY-MM-DDTHH:MM:SS.SSS+ZZ (where +ZZ is either -/+ UTC offset)
YYYY-MM-DDTHH:MM:SS+ZZ
YYYY-MM-DDTHH:MM+ZZ
YYYY-MM-DD (sets date only)
.EE
.
.TP
.BR get_clock
Get
.RI \(aq RigTime \(aq
.IP
Gets rig clock -- note that some rigs do not handle seconds or milliseconds.
Format is ISO8601 YYYY-MM-DDTHH:MM:SS.sss+ZZ where +ZZ is either -/+ UTC offset
.
.TP
.BR chk_vfo
Get
.RI \(aq Status \(aq
Expand Down
23 changes: 23 additions & 0 deletions doc/man1/rigctld.1
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,29 @@ and
also need to be provided as output power may vary according to these values.
.IP
VFO parameter is not used in VFO mode.
.TP
.BR set_clock " \(aq" \fIDateTime\fP \(aq
Set
.RI \(aq DateTime \(aq
.IP
Sets rig clock -- note that some rigs do not handle seconds or milliseconds.
If you try to set that you will get a debug warning message.
Format is ISO8601.
.EX
Formats accepted
YYYY-MM-DDTHH:MM:SS.sss+ZZ (where +ZZ is either -/+ UTC offset)
YYYY-MM-DDTHH:MM:SS+ZZ
YYYY-MM-DDTHH:MM+ZZ
YYYY-MM-DD (sets date only)
.EE
.
.TP
.BR get_clock
Get
.RI \(aq RigTime \(aq
.IP
Gets rig clock -- note that some rigs do not handle seconds or milliseconds.
Format is ISO8601 YYYY-MM-DDTHH:MM:SS.sss+ZZ where +ZZ is either -/+ UTC offset
.
.TP
.B chk_vfo
Expand Down
4 changes: 4 additions & 0 deletions include/hamlib/rig.h
Original file line number Diff line number Diff line change
Expand Up @@ -1980,6 +1980,8 @@ struct rig_caps {
rmode_t *mode,
pbwidth_t *width,
split_t *split);
int(*set_clock) (RIG *rig, int year, int month, int day, int hour, int min, int sec, double msec, int utc_offset);
int(*get_clock) (RIG *rig, int *year, int *month, int *day, int *hour, int *min, int *sec, double *msec, int *utc_offset);

const char *clone_combo_set; /*!< String describing key combination to enter load cloning mode */
const char *clone_combo_get; /*!< String describing key combination to enter save cloning mode */
Expand Down Expand Up @@ -3175,6 +3177,8 @@ extern HAMLIB_EXPORT(int) rig_get_vfo_info(RIG *rig, vfo_t vfo, freq_t *freq, rm
extern HAMLIB_EXPORT(int) rig_get_rig_info(RIG *rig, char *response, int max_response_len);
extern HAMLIB_EXPORT(int) rig_get_cache(RIG *rig, vfo_t vfo, freq_t *freq, int * cache_ms_freq, rmode_t *mode, int *cache_ms_mode, pbwidth_t *width, int *cache_ms_width);

extern HAMLIB_EXPORT(int) rig_set_clock(RIG *rig, int year, int month, int day, int hour, int min, int sec, double msec, int utc_offset);
extern HAMLIB_EXPORT(int) rig_get_clock(RIG *rig, int *year, int *month, int *day, int *hour, int *min, int *sec, double *msec, int *utc_offset);

typedef unsigned long rig_useconds_t;
extern HAMLIB_EXPORT(int) hl_usleep(rig_useconds_t msec);
Expand Down
55 changes: 54 additions & 1 deletion rigs/dummy/dummy.c
Original file line number Diff line number Diff line change
Expand Up @@ -2140,6 +2140,55 @@ static int dummy_mW2power(RIG *rig, float *power, unsigned int mwpower,
RETURNFUNC(RIG_OK);
}

static int m_year, m_month, m_day, m_hour, m_min, m_sec, m_utc_offset;
static double m_msec;

int dummy_set_clock(RIG *rig, int year, int month, int day, int hour, int min,
int sec, double msec, int utc_offset)
{
int retval = RIG_OK;

rig_debug(RIG_DEBUG_VERBOSE, "%s: %04d-%02d-%02dT%02d:%02d:%02d.%.03f%s%02d\n",
__func__, year,
month, day, hour, min, sec, msec, utc_offset >= 0 ? "+" : "-",
(unsigned)(abs(utc_offset)));
m_year = year;
m_month = month;
m_day = day;

if (hour >= 0)
{
m_hour = hour;
m_min = min;
m_sec = sec;
m_msec = msec;
m_utc_offset = utc_offset;
}

return retval;
}

int dummy_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
int *min, int *sec, double *msec, int *utc_offset)
{
int retval = RIG_OK;

*year = m_year;
*month = m_month;
*day = m_day;
*hour = m_hour;
*min = m_min;
*sec = m_sec;
*msec = m_msec;
*utc_offset = m_utc_offset;

rig_debug(RIG_DEBUG_VERBOSE,
"%s: %02d-%02d-%02dT%02d:%02d:%02d:%0.3lf%s%02d\n'",
__func__, *year, *month, *day, *hour, *min, *sec, *msec,
*utc_offset >= 0 ? "+" : "-", (unsigned)abs(*utc_offset));
return retval;
}


/*
* Dummy rig capabilities.
Expand Down Expand Up @@ -2195,7 +2244,7 @@ struct rig_caps dummy_caps =
RIG_MODEL(RIG_MODEL_DUMMY),
.model_name = "Dummy",
.mfg_name = "Hamlib",
.version = "20210705.0",
.version = "20211130.0",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_OTHER,
Expand Down Expand Up @@ -2415,6 +2464,8 @@ struct rig_caps dummy_caps =
.get_trn = dummy_get_trn,
.power2mW = dummy_power2mW,
.mW2power = dummy_mW2power,
.set_clock = dummy_set_clock,
.get_clock = dummy_get_clock
};

struct rig_caps dummy_no_vfo_caps =
Expand Down Expand Up @@ -2580,6 +2631,8 @@ struct rig_caps dummy_no_vfo_caps =
.get_trn = dummy_get_trn,
.power2mW = dummy_power2mW,
.mW2power = dummy_mW2power,
.set_clock = dummy_set_clock,
.get_clock = dummy_get_clock
};

DECLARE_INITRIG_BACKEND(dummy)
Expand Down

0 comments on commit a1c8493

Please sign in to comment.