From 560095698c6689390a9ce14f3836dbe85f8b39e2 Mon Sep 17 00:00:00 2001 From: westpacsailor <114281758+westpacsailor@users.noreply.github.com> Date: Sun, 29 Nov 2026 12:44:13 -0600 Subject: [PATCH] Let macros set the scope reference level on Icom radios A macro step that sets Scope Ref took its value type from the cache. The Icom reply parser cached Scope Ref as short, but the encoder only accepts int (as the UI sends it), so on a receiver with a cached value the step logged "Scope Ref Got unknown value type short" and sent nothing. On a receiver with nothing cached the step fell back to uchar, which only worked for 0 by chance and can't hold negative levels. - Cache the Scope Ref reply as int, matching the UI and the encoder. - Always send macro Scope Ref steps as int. The value is in tenths of a dB, as on the Ref slider (e.g. -100 = -10.0 dB). Co-Authored-By: Claude Opus 5.5 --- src/MainController.cpp | 8 +++++++- src/radio/icomcommander.cpp | 5 ++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/MainController.cpp b/src/MainController.cpp index 9a8c9b0c..9e85d227 100644 --- a/src/MainController.cpp +++ b/src/MainController.cpp @@ -1237,8 +1237,14 @@ bool MainController::executeMacroRadioStep(funcs func, const QString& parameter, // The cache isn't read for levels at all: a stale entry makes getCache() // queue a read ahead of the set, and its old-value reply moves the // slider back after the immediate UI update below. - const QVariant current = level ? QVariant() : queue->getCache(func, valueRx).value; + // Scope Ref is a signed dB value that every commander takes as int, as + // the UI sends it. Don't guess it from the cache: when nothing was cached + // (e.g. for Sub), the fallback below picked uchar, which can't hold + // negative levels. + const bool scopeRef = (func == funcScopeRef); + const QVariant current = (level || scopeRef) ? QVariant() : queue->getCache(func, valueRx).value; int valueType = level ? int(QMetaType::UShort) + : scopeRef ? int(QMetaType::Int) : current.isValid() ? current.userType() : (type.maxVal > 255 ? int(QMetaType::UShort) : int(QMetaType::UChar)); diff --git a/src/radio/icomcommander.cpp b/src/radio/icomcommander.cpp index de05b0f3..a80cae14 100644 --- a/src/radio/icomcommander.cpp +++ b/src/radio/icomcommander.cpp @@ -2467,7 +2467,10 @@ void icomCommander::parseCommand() if(negative){ ref *= (-1*negative); } - value.setValue(ref); + // Cached as int, the type the UI sends and the encoder accepts. A + // short here made macros (which copy the cached type) send a value + // the encoder rejected ("Got unknown value type short"). + value.setValue(int(ref)); break; } case funcScopeSpeed: -- 2.56.0.windows.4