Skip to content

Commit

Permalink
Fix Lua Mixer Scripts source naming (#842)
Browse files Browse the repository at this point in the history
* getSourceString() return a correct string for lcdcolor when the source
es a LUA script

* getSourceString() return a formated string with instanceName or
scriptName and outputName

Co-authored-by: Runsys16 <rene.negre@orange.com>
  • Loading branch information
2 people authored and pfeerick committed Oct 6, 2021
1 parent 6c93d3b commit 261bbd2
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions radio/src/strhelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,23 @@ char * getSourceString(char * dest, mixsrc_t idx)
div_t qr = div(idx-MIXSRC_FIRST_LUA, MAX_SCRIPT_OUTPUTS);
if (qr.quot < MAX_SCRIPTS && qr.rem < scriptInputsOutputs[qr.quot].outputsCount) {
*dest++ = CHAR_LUA;
// *dest++ = '1'+qr.quot;
strcpy(dest, scriptInputsOutputs[qr.quot].outputs[qr.rem].name);
// temporary string
#define MAX_CHAR 16
char temp[MAX_CHAR];
strncpy( temp, g_model.scriptsData[qr.quot].name, MAX_CHAR );

// instance Name is empty : dest = n-ScriptFileName/OutputName
if ( temp[0]== 0) {
snprintf( temp, MAX_CHAR, "%d-%s/%s", qr.quot+1,
g_model.scriptsData[qr.quot].file,
scriptInputsOutputs[qr.quot].outputs[qr.rem].name );
// instance Name is not empty : dest = InstanceName/OutputName
} else {
snprintf( temp, MAX_CHAR, "%s/%s", g_model.scriptsData[qr.quot].name,
scriptInputsOutputs[qr.quot].outputs[qr.rem].name );
}

strcpy( dest, temp);
}
#else
strcpy(dest, "N/A");
Expand Down

0 comments on commit 261bbd2

Please sign in to comment.