Re: Help with conditional presets #UnO2


chrisw_63
 
Edited

Hmm... it would seem that the compiler doesn't consider the commands inside the conditionals.  The easy solution is to move one or more of them outside the conditionals.  Since the PC command is common for all of the conditions, just move that one outside the IF block, after all the conditions.  Setting $miniprog to zero is great, but then you didn't use the variable in the last two PC commands, which may have left you thinking they weren't the same as the first one (it may save a couple bytes in the written program, but it won't change what the compiler puts out).  Always be consistent with the use of your variables.  You did well naming it with what it's used for, so use it consistently and when you look at the code later, it'll be clear exactly what that zero means.

Since both of those zeroes represent $miniprog anyway, remove the PC command, and put one call to it just before the closing brace.  The compiler will see it and be happy.

PRESET Mini PC Up =
{
   IF $miniprog < 99
   {
    ...
   }
   ELSE IF..
   {
   ...
   }
   ELSE IF..
   {
   ...
   }
   SendMidi Minilogue ProgChange $miniprog
}

Join uno@fcb1010.groups.io to automatically receive all group messages.