/* each menu item is a single hex digit */ static int thd72_get_menu_item(RIG *rig, int item, int hi, int *val) { int retval, lval; char c, buf[48]; retval = thd72_get_menu_info(rig, buf); if (retval != RIG_OK) { return retval; } c = buf[3 + 2 * item]; /* "MU 0,1,2 ... */ if (c >= '0' && c <= '9') { lval = c - '0'; } else if (c >= 'A' && c <= 'F') { lval = c - 'A' + 10; } else { return -RIG_EPROTO; } if (lval > hi) { return -RIG_EPROTO; } *val = lval; return RIG_OK; }
static int thd72_set_menu_item(RIG* rig, int item, int val) { int retval; char c, buf[48]; retval = thd72_get_menu_info(rig, buf); if (retval != RIG_OK) return retval; if (val < 10) c = val + '0'; else c = val - 10 + 'A'; buf[3 + 2*item] = c; return kenwood_simple_transaction(rig, buf, 40); }