kopia lustrzana https://github.com/Hamlib/Hamlib
Implement kenwood_set_clock
Add warning to man page about NTP use and aux clock display.pull/1612/head
rodzic
496d8fde31
commit
d81726e724
|
@ -1320,10 +1320,15 @@ YYYY-MM-DD (sets date only)
|
|||
local (sets both clocks to local time)
|
||||
utc (sets both clocks to utc time)
|
||||
Note: Icom rigs expect you to set local time and the hours off to UTC.
|
||||
So...4PM EST example would be 2021-12-01T16:00:00+0500
|
||||
So...4PM EST example would be 2021-12-01T16:00:00-0500
|
||||
But...if you want to display GMT you must set the clock for GMT with zero UTC offset.
|
||||
Hopefully Icom will allow displaying either clock in the future
|
||||
|
||||
Note: Kenwood rigs only allow setting local clock, and then only if not autoset by NTP.
|
||||
Trying to set clock when NTP is in use will set the offset, but not the time -
|
||||
and no error status will be returned.
|
||||
Time displayed on the auxiliary clock is solely determined by UTC and the aux offset.
|
||||
|
||||
.EE
|
||||
.
|
||||
.TP
|
||||
|
|
|
@ -6011,7 +6011,46 @@ int kenwood_set_ext_parm(RIG *rig, hamlib_token_t token, value_t val)
|
|||
*/
|
||||
int kenwood_set_clock(RIG *rig, int year, int month, int day, int hour, int min, int sec, double msec, int utc_offset)
|
||||
{
|
||||
return -RIG_ENIMPL;
|
||||
char cmd[20];
|
||||
int retval, kenwood_val;
|
||||
|
||||
/* Do the offset first. Then if the clock is synced to NTP,
|
||||
* the set failure still should allow correct display
|
||||
*
|
||||
* utc_offset = hours * 100 + minutes
|
||||
* Kenwood value = 15 minute intervals normalized to 56 ( = UTC+00)
|
||||
*/
|
||||
// Convert utc_offset to minutes
|
||||
kenwood_val = ((utc_offset / 100) * 60) + (utc_offset % 100);
|
||||
// Now convert to 15 minute intervals, centered on 56
|
||||
kenwood_val = kenwood_val / 15 + 56;
|
||||
SNPRINTF(cmd, sizeof(cmd), "CK2%03d", kenwood_val);
|
||||
retval = kenwood_transaction(rig, cmd, NULL, 0);
|
||||
if (retval != RIG_OK) {return retval;}
|
||||
|
||||
// Offset is set, now check if clock is settable
|
||||
retval = kenwood_transaction(rig, "CK6", cmd, sizeof(cmd));
|
||||
if (retval != RIG_OK) {return retval;}
|
||||
if (cmd[3] == '1')
|
||||
{
|
||||
// OK, autoset by NTP is on so we can't set it
|
||||
// What should we tell the user?
|
||||
// Until I hear otherwise, pretend everything worked, and
|
||||
// the local clock should display the correct time in whatever
|
||||
// zone the app thought it was trying to set.
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
// Local clock should be settable; build the command
|
||||
SNPRINTF(cmd, sizeof(cmd), "CK0%02d%02d%02d%02d%02d%02d", year % 100, month, day,
|
||||
hour, min, sec);
|
||||
if (RIG_IS_TS990S)
|
||||
{ // TS-990S does not have seconds
|
||||
cmd[13] = '\0';
|
||||
}
|
||||
retval = kenwood_transaction(rig, cmd, NULL, 0);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Ładowanie…
Reference in New Issue