V1.3 - Added support for all IC-746 modes and frequencies 100MHz and greater

main
kk4das 2023-01-24 22:11:39 -05:00
rodzic b9fa9c8970
commit 054ffd5937
6 zmienionych plików z 85 dodań i 34 usunięć

0
.development 100644
Wyświetl plik

Wyświetl plik

@ -1,9 +1,16 @@
/************************************************************************* /*************************************************************************
IC746 CAT Library, by KK4DAS, Dean Souleles IC746 CAT Library, by KK4DAS, Dean Souleles
V1.0.2 12/17/2021 V1.3 1/21/2023
- Send NACK on receipt of undocumented commands / fix for latest WSJTX Hamlib - Included all defined modes in Get/Set Mode (thanks to Mike, KA4CDN)
- Fix to allow frequencies greater than 100MHz -(thanks to Bob, KA1GT)
V1.0.1 2/3/2021
V1.2 10/22/2021
- Fixes bug that caused "WSJTX Rig Control Error" for versions after 2.2.2
- The problem was caused by an unsupported CIV command being sent by WSJTX
- This fix responds to unimplemented commands with a NACK instead of an ACK
- Bug was reported on the WSJTX groups board.
V1.1 2/3/2021
- various fixes, now works properly with OmniRig and flrig - various fixes, now works properly with OmniRig and flrig
- smeter now returns proper BCD code - calibrated to emulate ICOM responses - smeter now returns proper BCD code - calibrated to emulate ICOM responses
@ -36,10 +43,11 @@
#define DEBUG_CAT_DETAIL #define DEBUG_CAT_DETAIL
//#define DEBUG_CAT_SMETER //#define DEBUG_CAT_SMETER
#include <SoftwareSerial.h> #include <SoftwareSerial.h>
SoftwareSerial catDebug(6, 7); // RX, TX SoftwareSerial catDebug(11,12); // RX, TX
String dbg; String dbg;
#endif #endif
//extern void displayBanner(String s);
// User supplied calback function work variables, must be static // User supplied calback function work variables, must be static
static FuncPtrBoolean catSplit; static FuncPtrBoolean catSplit;
@ -107,8 +115,8 @@ static FuncPtrVoid catSwapVfo;
*/ */
void IC746::begin() { void IC746::begin() {
Serial.begin(9600, SERIAL_8N2); Serial.begin(9600, SERIAL_8N2);
while (!Serial);; // while (!Serial);;
Serial.flush(); // Serial.flush();
#ifdef DEBUG_CAT #ifdef DEBUG_CAT
catDebug.begin(9600); catDebug.begin(9600);
@ -127,11 +135,15 @@ void IC746::begin(long br, int mode) {
SERIAL_7O1; SERIAL_8O1; SERIAL_5O2; SERIAL_6O2; SERIAL_7O2; SERIAL_8O2 SERIAL_7O1; SERIAL_8O1; SERIAL_5O2; SERIAL_6O2; SERIAL_7O2; SERIAL_8O2
*/ */
Serial.begin(br, mode); Serial.begin(br, mode);
Serial.flush(); // Serial.flush();
#ifdef DEBUG_CAT #ifdef DEBUG_CAT
catDebug.begin(9600); catDebug.begin(9600);
dbg = "CAT Debug Ready"; dbg = "CAT Debug Ready";
catDebug.println(dbg.c_str()); catDebug.println(dbg.c_str());
delay(1000);
catDebug.println(dbg.c_str());
catDebug.println(dbg.c_str());
catDebug.println(dbg.c_str());
#endif #endif
} }
@ -240,7 +252,7 @@ void IC746::sendResponse(byte *buf, int len) {
// sendAck() - send back hard-code acknowledge message // sendAck() - send back hard-code acknowledge message
// //
void IC746::sendAck() { void IC746::sendAck() {
byte ack[] = {CAT_CTRL_ADDR, CAT_RIG_ADDR, CAT_ACK}; byte ack[] = {CAT_RIG_ADDR, CAT_CTRL_ADDR, CAT_ACK};
send(ack, 3); send(ack, 3);
} }
@ -248,7 +260,8 @@ void IC746::sendAck() {
// sendNack() - send back hard-code negative-acknowledge message // sendNack() - send back hard-code negative-acknowledge message
// //
void IC746::sendNack() { void IC746::sendNack() {
byte nack[] = {CAT_CTRL_ADDR, CAT_RIG_ADDR, CAT_NACK}; byte nack[] = {CAT_RIG_ADDR, CAT_CTRL_ADDR, CAT_NACK};
// displayBanner(String("Nack"));
send(nack, 3); send(nack, 3);
} }
@ -500,6 +513,7 @@ void IC746::doSetFreq() {
/////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////
void IC746::doReadFreq() { void IC746::doReadFreq() {
if (catGetFreq) { if (catGetFreq) {
// displayBanner(String("Read Freq"));
FreqtoBCD(catGetFreq()); // get the frequency, convert to BCD and stuff it in the response buffer FreqtoBCD(catGetFreq()); // get the frequency, convert to BCD and stuff it in the response buffer
sendResponse(cmdBuf, CAT_SZ_FREQ); sendResponse(cmdBuf, CAT_SZ_FREQ);
} }
@ -507,16 +521,22 @@ void IC746::doReadFreq() {
/////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////
// doSetMode() - process the CAT_SET_MODE command // doSetMode() - process the CAT_SET_MODE command
// Call the user function to put the rig into the requested mode. Only USB or LSB are supported. // Call the user function to put the rig into the requested mode.
// The rig must handle all of the possible modes
// CAT_MODE_LSB
// CAT_MODE_USB
// CAT_MODE_AM:
// CAT_MODE_CW - (LSB)
// CAT_MODE_RTTY - (LSB)
// CAT_MODE_FM
// CAT_MODE_CW_R - (Reverse - USB)
// CAT_MODE_RTTY_R - (Reverse - LSB)
/////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////
void IC746::doSetMode() { void IC746::doSetMode() {
if (catSetMode) { if (catSetMode) {
switch (cmdBuf[CAT_IX_SUB_CMD]) {
case CAT_MODE_LSB: catSetMode(cmdBuf[CAT_IX_SUB_CMD]);
case CAT_MODE_USB:
catSetMode(cmdBuf[CAT_IX_SUB_CMD]);
break;
}
} }
sendAck(); sendAck();
} }
@ -702,8 +722,12 @@ void IC746::check() {
default: // For all other commands respond with an NACK default: // For all other commands respond with an NACK
#ifdef DEBUG_CAT #ifdef DEBUG_CAT
String dbg;
dbg = "unimp cmd: "; dbg = "unimp cmd: ";
dbg += String(cmdBuf[CAT_IX_CMD], HEX); dbg += String(cmdBuf[CAT_IX_CMD], HEX);
dbg += " ";
dbg += String(cmdBuf[CAT_IX_SUB_CMD], HEX);
// displayBanner(dbg);
catDebug.println(dbg.c_str()); catDebug.println(dbg.c_str());
#endif #endif
sendNack(); sendNack();
@ -737,12 +761,15 @@ long IC746::BCDtoFreq() {
freq += 100000L * (cmdBuf[CAT_IX_FREQ + 2] >> 4); freq += 100000L * (cmdBuf[CAT_IX_FREQ + 2] >> 4);
freq += 1000000L * (cmdBuf[CAT_IX_FREQ + 3] & 0xf); freq += 1000000L * (cmdBuf[CAT_IX_FREQ + 3] & 0xf);
freq += 10000000L * (cmdBuf[CAT_IX_FREQ + 3] >> 4); freq += 10000000L * (cmdBuf[CAT_IX_FREQ + 3] >> 4);
freq += 100000000L * (cmdBuf[CAT_IX_FREQ + 4] & 0xf);
freq += 1000000000L * (cmdBuf[CAT_IX_FREQ + 4] >> 4);
return freq; return freq;
} }
void IC746::FreqtoBCD(long freq) { void IC746::FreqtoBCD(long freq) {
byte ones, tens, hund, thou, ten_thou, hund_thou, mil, ten_mil; byte ones, tens, hund, thou, ten_thou, hund_thou, mil, ten_mil, hund_mil, thou_mil;
ones = byte(freq % 10); ones = byte(freq % 10);
tens = byte((freq / 10L) % 10); tens = byte((freq / 10L) % 10);
@ -757,11 +784,12 @@ void IC746::FreqtoBCD(long freq) {
cmdBuf[CAT_IX_FREQ + 2] = byte((hund_thou << 4)) | ten_thou; cmdBuf[CAT_IX_FREQ + 2] = byte((hund_thou << 4)) | ten_thou;
mil = byte((freq / 1000000L) % 10); mil = byte((freq / 1000000L) % 10);
ten_mil = byte(freq / 10000000L); ten_mil = byte(freq / 10000000L) % 10;
cmdBuf[CAT_IX_FREQ + 3] = byte((ten_mil << 4)) | mil; cmdBuf[CAT_IX_FREQ + 3] = byte((ten_mil << 4)) | mil;
cmdBuf[CAT_IX_FREQ + 4] = 0; // fixed hund_mil = byte((freq / 100000000L) % 10);
thou_mil = byte(freq / 1000000000L % 10); // Allow frequencies up to 9999.999999 MHz to be enterd
cmdBuf[CAT_IX_FREQ + 4] = byte((thou_mil << 4)) | hund_mil;
} }
void IC746::SmetertoBCD(byte s) { void IC746::SmetertoBCD(byte s) {

26
IC746.h
Wyświetl plik

@ -1,9 +1,14 @@
/************************************************************************* /*************************************************************************
IC746 CAT Library, by KK4DAS, Dean Souleles IC746 CAT Library, by KK4DAS, Dean Souleles
V1.0.2 12/17/2021 V1.3 1/24/2023
- Send NACK on undocmented command / fix for lates WSJTX hamlib - Added support for frequencies 100MHz and above.
- Added support for setting and getting all IC-746 defined MODES
V1.0.1 2/3/2021
V1.2
- Fixes bug that caused WSJTX not to connect. Sends NACK on all unsupported
- commands. (Requires lastes hamlib build with WSJTX)
V1.1 2/3/2021
- various fixes, now works properly with OmniRig and flrig - various fixes, now works properly with OmniRig and flrig
- smeter now returns proper BCD code - calibrated to emulate ICOM responses - smeter now returns proper BCD code - calibrated to emulate ICOM responses
@ -84,12 +89,13 @@
// Mode Subcommand // Mode Subcommand
#define CAT_MODE_LSB 0x00 #define CAT_MODE_LSB 0x00
#define CAT_MODE_USB 0x01 #define CAT_MODE_USB 0x01
#define CAT_MODE_AM 0x02 // Not implemented #define CAT_MODE_AM 0x02
#define CAT_MODE_CW 0x03 // Not implemented #define CAT_MODE_CW 0x03 // LSB CW
#define CAT_MODE_RTTY 0x04 // Not implemented #define CAT_MODE_RTTY 0x04 // LSB RTTY
#define CAT_MODE_FM 0x05 // Not implemented #define CAT_MODE_FM 0x05
#define CAT_MODE_CW_R 0x06 // Not implemented #define CAT_MODE_CW_R 0x07 // Reverse CW - USB
#define CAT_MODE_RTTY_R 0x07 // Not implemented #define CAT_MODE_RTTY_R 0x08 // Reverse RTTY - USB
#define CAT_MODE_FILTER1 0x01 // Required for "read mode" #define CAT_MODE_FILTER1 0x01 // Required for "read mode"
// VFO Subcommand // VFO Subcommand

10
IC746CAT.ino 100644
Wyświetl plik

@ -0,0 +1,10 @@
// Dummy Sketch to allow editing of Nextion Lbrary files in the IDE
#include "IC746.h"
void setup() {
}
void loop() {
}

Wyświetl plik

@ -35,6 +35,13 @@ So far we have tested support for the following CAT capable software:
If you use find this library does not work with any particular CAT enabled software please let me know via the "Issues" tab on Github. If you use find this library does not work with any particular CAT enabled software please let me know via the "Issues" tab on Github.
## Release Notes ##
Version 1.3 1/24/2023 - support for frequencies 100MHz and above. Support for setting and getting all defined IC746 modes.
Version 1.2 - Corrects bug that was causing new version of WSJTX not to connect. Sends NACK on all unsupported commands,
Version 1.0 - Initial release.
## Known limitations ## ## Known limitations ##
Split frequency handling in WSJTX does not work as expected. The work-around is to configure WSJTX Split for either NONE or "Fake it". Split functionality has been tested and works as expected using CatBkt. Split frequency handling in WSJTX does not work as expected. The work-around is to configure WSJTX Split for either NONE or "Fake it". Split functionality has been tested and works as expected using CatBkt.

Wyświetl plik

@ -1,9 +1,9 @@
name=ICOM 746 CAT Control name=ICOM 746 CAT Control
version=1.0.2 version=1.3.0
author=Dean Souleles, KK4DAS, <kk4das@gmail.com> author=Dean Souleles, KK4DAS, <kk4das@gmail.com>
maintainer=Dean Souleles, KK4DAS, <kk4das@gmail.com> maintainer=Dean Souleles, KK4DAS, <kk4das@gmail.com>
sentence=Simulate an ICOM 746 radio from the CAT point of view. sentence=Simulate an ICOM 746 radio from the CAT point of view.
paragraph=This lirary emulates the Computer Assisted Transceiver (CAT) control behavior of an ICOM 746. It is intended to be included in a conrol program for an amateur radio. It provides all of the functionality required for programs like FLDIG and WSJTX to be able to control your rig. paragraph=This lirary emulates the Computer Assisted Transceiver (CAT) control behavior of an ICOM 746. It is intended to be included in a conrol program for an amateur radio. It provides all of the functionality required for programs like FLDIG and WSJTX to be able to control your rig.
category=Other category=Other
url=https://github.com/kk4das/IC746CAT url=https://github.com/KK4DAS/IC746/
architectures=* architectures=*