Major step in the new AVR interface to send commands. It compiles, but is untested. The old code and function remains active.

This commit is contained in:
2026-01-28 17:18:59 -06:00
parent e2829f648d
commit a83bc28a8d
5 changed files with 534 additions and 63 deletions

View File

@@ -46,11 +46,14 @@ public:
} AVROnOff_E;
typedef enum {
eVolumeUp,
eVolumeDown,
eUp,
eDown,
} AVRUpDown_E;
typedef enum {
eMuteOn,
eMuteOff
} AVRVolume_E;
} AVRMute_E;
typedef enum {
eOSDOff,
@@ -89,7 +92,9 @@ public:
e3,
e4,
e5,
e6, e7, e8
e6,
e7,
e8
} AVRPresetNum_E;
typedef enum {
@@ -99,7 +104,7 @@ public:
eD,
eE,
eF
} AVR_PresetPage_E;
} AVRPresetPage_E;
typedef enum {
ePhono,
@@ -118,51 +123,213 @@ public:
} AVRInput_E;
typedef enum {
cmdZone1,
cmdZone2,
cmdZone3,
cmdSpeakerSetB,
cmdNightMode,
cmdTrigControl1,
cmdTrigControl2
eMain,
eZone1,
eZone2,
eZone3,
eZoneOR
} AVRSubsystem_E;
typedef enum {
Hall_A,
Hall_B,
Hall_C,
Hall_USA,
Hall_E,
Live_Concert,
Tokyo,
Freiburg,
Royaumont,
Village_Gate,
Village_Vanguard,
The_Bottom_Line,
The_Roxy_Theater,
Warehouse_Loft,
Arena,
Disco,
Party,
Game,
Stereo_6_8Ch,
Pop_Rock,
DJ,
Opera,
Pavillion,
Mono_Movie,
Variety_Sports,
Spectacre,
Sci_Fi,
Adventure,
General,
Normal,
Enhanced,
PLII_Movie,
PLII_Music,
Neo_6_Movie,
Neo_6_Music,
Direct_2Ch,
Stereo_2Ch,
THX_Ultra_PL,
THX_Music,
THX_Ultra_PL2,
THX_Ultra_NEO6
} AVRDSPProg_E;
typedef enum {
eInpAuto,
eDD_RF,
eDTS,
eDigital,
eAnalog,
eAAC
} AVRInputMode_E;
typedef enum {
eDualMain,
eDualSub,
eDualAll
} AVRDualMono_E;
typedef enum {
fncPower,
fncVolume,
fncMute,
fncVolumeMemory,
fncVolumeRecall,
fncSpeakerAOnOff,
fncSpeakerBOnOff,
fncSpeakerBZone,
fncZone2SpeakerOnOff,
fncNightModeOnOff,
fncEffect,
fncInput,
fncRadioBand,
fncRadioTune,
fncRadioPresetPage,
fncRadioPresetNumber,
fncRadioPresetMemory,
fncRadioPresetRecall,
fncDSPProgram,
fncSleep,
fncOSD,
fnc6ChInput,
fncEx_EsOnOff,
fncInputMode,
fncDualMono,
fncDC1TrigControl,
fncDC2TrigControl,
fncDC1OnOff,
fncDC2OnOff,
} AVRFunction_E;
typedef union {
AVROnOff_E onOff;
AVRUpDown_E volume;
AVRMute_E mute;
AVRPresetPage_E volumeMemory;
AVRPresetPage_E volumeRecall;
AVROnOff_E speakerA;
AVROnOff_E speakerB;
AVRSubsystem_E speakerBZone;
AVROnOff_E zone2Speaker;
AVROnOff_E nightMode;
AVRInput_E input;
AVRTunerBand_E band;
AVRUpDown_E tune;
AVRPresetPage_E presetPage;
AVRPresetNum_E presetNumber;
AVRPresetPage_E presetMemory;
AVRPresetPage_E presetRecall;
AVRDSPProg_E program;
AVRSleep_E sleep;
AVROSDScreen_E osd;
AVROnOff_E sixChInput;
AVREX_ES_E ex_es;
AVRInputMode_E inputMode;
AVRDualMono_E dualMono;
AVRSubsystem_E dc1TrigControl;
AVRSubsystem_E dc2TrigControl;
AVROnOff_E dc1OnOff;
AVROnOff_E dc2OnOff;
char *pMessage;
} AVRArgument_UX;
typedef uint32_t AVRArg_T;
/// @brief The single command path to control the AVR
///
/// This lets you send a command to the AVR using this single interface, by choosing
/// the AVR Subsystem of interest, the Function of interest, and passing an argument.
///
/// @param[in] subsystem: Main | Zone 1 | Zone 2 | Zone 3
/// @param[in] function : Power, Speaker, Volume, etc.
/// @param[in] arg: on/off, etc.
/// @return
bool AVRCommand(AVRInterface::AVRSubsystem_E subsystem,
AVRInterface::AVRFunction_E function,
AVRArg_T arg);
/// @brief Send the power command
/// @param cmd
/// @return true
///
bool Power(AVROnOff_E cmd);
bool VolumeButton(AVRUpDown_E cmd);
bool VolumeButton(AVRVolume_E cmd);
/// @brief AVRMessageType_T
///
/// Indicates the type of message being sent to the status change callback
///
typedef enum {
mtModelInfo,
mtStatus, // Special State machine status
mtInfo, // General purpose information
mtStreamStart, // Stream start
mtStream, // Status stream that word-wraps...
mtModelInfo, ///<! Model information
mtStatus, ///<! Special State machine status (possibly useful in a dedicate place on the UI)
mtInfo, ///<! General purpose information (chunks of information that might be useful in a small scroll region)
mtStreamStart, ///<! Stream start of the status, each chunk is a generally a same-length string, totaling 100s of bytes.
mtStream, ///<! Status stream that word-wraps...
} AVRMessageType_T;
/// @brief StatusChangeCallback
///
/// This is the function prototype for the status change callback from the AVR interface.
/// This can be used to interpret, or more commonly to display, various types of status information.
///
/// @param[in] type is the type of message being sent
/// @param[in] msg is the text message
///
typedef void (*StatusChangeCallback)(AVRMessageType_T type, const char *msg);
/// @brief allows the host to register a callback for status changes
///
/// the callback information is text
/// the callback information is always text
///
/// @param StatusChangeCallback
/// @return
bool RegisterInformationCallback(void (*StatusChangeCallback)(AVRMessageType_T type, const char * msg));
/// @param[in] cb is the callback function, or register NULL to unregister
/// @return true always
///
bool RegisterInformationCallback(StatusChangeCallback cb);
/// @brief This will loop through the DT array and report the status of everything
/// ReportAllStatus
///
/// @brief This will loop through the DT array and report the status of everything via the registered callback
///
void ReportAllStatus();
/// ProcessSerialQueue
///
/// @brief This is public to start, maybe forever because it offers the generic capability
/// @param p the message to send
/// @param len of the message
/// @param[in] p the message to send
/// @param[in] len of the message
/// @return true
///
bool ProcessSerialQueue(const void *p = NULL, uint16_t len = NULL);
/// AVRSendOSDMessage
///
/// @brief Send a text message to the AVR for display on the connected TV
/// @param[in] msg is a text string, which must not exceed 16 characters in length, is null terminated
/// and is restricted to the following characters:
/// " !#%&()*+,-.0123456789:<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ[]_abcdefghijklmnopqrstuvwxyz"
/// @return true if the message was accepted for sending, false if it is too long or has invalid characters.
///
bool AVRSendOSDMessage(const char *msg);
private:
uint32_t sentAtTime_ms;
@@ -365,6 +532,7 @@ private:
SerialQueue_T serialQueue[SERIALQUEUESIZE];
int serialQueueCount = 0;
bool bFirstTickInitialized;
uint32_t firstTick_ms; // basically the time when the program started
uint32_t lastTick_ms; // @TODO instead of this, offer a way for the class to get the current time