Updated gen_blumen_lumen to be able to output both UART and SACN variants
This commit is contained in:
parent
f261cbd55a
commit
9a643cd5b6
|
@ -61,7 +61,10 @@ BuildLoop(gs_string* OutputBuffer, loop_desc Desc)
|
|||
Channel = Desc.ChannelStart + i;
|
||||
}
|
||||
|
||||
WriteLedStripOpen(OutputBuffer, Channel, Desc.ComPort);
|
||||
u32 SACNUniverseStart = 0;
|
||||
u32 SACNChannelStart = 0;
|
||||
WriteLedStripOpen(OutputBuffer, Channel, Desc.ComPort,
|
||||
SACNUniverseStart, SACNChannelStart);
|
||||
WriteSegmentSequenceOpen(OutputBuffer, Desc.SubsegmentsCount);
|
||||
|
||||
for (u32 j = 0; j < Desc.SubsegmentsCount; j++)
|
||||
|
@ -184,6 +187,7 @@ int main(int ArgCount, char** Args)
|
|||
gs_string OutputBuffer1 = PushString(Ctx.Transient, MB(4));
|
||||
gs_string OutputBuffer2 = PushString(Ctx.Transient, MB(4));
|
||||
|
||||
#if 0
|
||||
WriteAssemblyUARTOpen(&OutputBuffer0,
|
||||
"Blumen Lumen - Silver Spring - 00",
|
||||
100,
|
||||
|
@ -202,6 +206,23 @@ int main(int ArgCount, char** Args)
|
|||
v3{1, 0, 0},
|
||||
21,
|
||||
"");
|
||||
#else
|
||||
WriteAssemblySACNOpen(&OutputBuffer0,
|
||||
"Blumen Lumen - Silver Spring - 00",
|
||||
100,
|
||||
v3{-1, 0, 0},
|
||||
21);
|
||||
WriteAssemblySACNOpen(&OutputBuffer1,
|
||||
"Blumen Lumen - Silver Spring - 01",
|
||||
100,
|
||||
v3{0, 0, 0},
|
||||
21);
|
||||
WriteAssemblySACNOpen(&OutputBuffer2,
|
||||
"Blumen Lumen - Silver Spring - 02",
|
||||
100,
|
||||
v3{1, 0, 0},
|
||||
21);
|
||||
#endif
|
||||
|
||||
u32 StripCount = 0;
|
||||
|
||||
|
|
|
@ -21,12 +21,18 @@ WriteIndented(gs_string* Buffer, u32 Indent, char* Format, ...)
|
|||
}
|
||||
|
||||
internal void
|
||||
WriteAssemblyUARTOpen(gs_string* Buffer, char* Name, u32 Scale, v3 Center, u32 StripCount, char* ComPort)
|
||||
WriteAssemblyCommonOpen(gs_string* Buffer, char* Name, u32 Scale, v3 Center, u32 StripCount)
|
||||
{
|
||||
WriteIndented(Buffer, 0, "assembly_name: \"%s\";\n", Name);
|
||||
WriteIndented(Buffer, 0, "assembly_scale: %d;\n", Scale);
|
||||
WriteIndented(Buffer, 0, "assembly_center: (%f, %f, %f);\n", Center.x, Center.y, Center.z);
|
||||
WriteIndented(Buffer, 0, "led_strip_count: %d;\n", StripCount);
|
||||
}
|
||||
|
||||
internal void
|
||||
WriteAssemblyUARTOpen(gs_string* Buffer, char* Name, u32 Scale, v3 Center, u32 StripCount, char* ComPort)
|
||||
{
|
||||
WriteAssemblyCommonOpen(Buffer, Name, Scale, Center, StripCount);
|
||||
WriteIndented(Buffer, 0, "output_mode: \"UART\";\n");
|
||||
|
||||
if (ComPort)
|
||||
|
@ -36,13 +42,29 @@ WriteAssemblyUARTOpen(gs_string* Buffer, char* Name, u32 Scale, v3 Center, u32 S
|
|||
}
|
||||
|
||||
internal void
|
||||
WriteLedStripOpen(gs_string* Buffer, u32 Channel, char* ComPort)
|
||||
WriteAssemblySACNOpen(gs_string* Buffer, char* Name, u32 Scale, v3 Center, u32 StripCount)
|
||||
{
|
||||
WriteAssemblyCommonOpen(Buffer, Name, Scale, Center, StripCount);
|
||||
WriteIndented(Buffer, 0, "output_mode: \"SACN\";\n");
|
||||
}
|
||||
|
||||
internal void
|
||||
WriteLedStripOpen(gs_string* Buffer, u32 UARTChannel, char* UARTComPort, u32 SACNStartUniverse, u32 SACNStartChannel)
|
||||
{
|
||||
WriteIndented(Buffer, 0, "led_strip:\n{\n");
|
||||
WriteIndented(Buffer, 1, "output_uart: {\n");
|
||||
WriteIndented(Buffer, 2, "channel: %d;\n", Channel);
|
||||
WriteIndented(Buffer, 2, "com_port: \"%s\";\n", ComPort);
|
||||
|
||||
// SACN
|
||||
WriteIndented(Buffer, 1, "output_sacn: {\n");
|
||||
WriteIndented(Buffer, 2, "start_universe: %d;\n", SACNStartUniverse);
|
||||
WriteIndented(Buffer, 2, "start_channel: %d;\n", SACNStartChannel);
|
||||
WriteIndented(Buffer, 1, "};\n\n");
|
||||
|
||||
// UART
|
||||
WriteIndented(Buffer, 1, "output_uart: {\n");
|
||||
WriteIndented(Buffer, 2, "channel: %d;\n", UARTChannel);
|
||||
WriteIndented(Buffer, 2, "com_port: \"%s\";\n", UARTComPort);
|
||||
WriteIndented(Buffer, 1, "};\n\n");
|
||||
|
||||
}
|
||||
|
||||
internal void
|
||||
|
|
Loading…
Reference in New Issue