Formatter problems with list item

I think there’s some problems with formatter functions. I’m trying right now to update my presets to 5.03 firmwire version, and most of my formatters not working at all.
Every formatter on my list items not working, when on 4.1.4 firmwire everything was working perfect. Some of controls have defined text overlays with dynamic range edit, and this dynamic range define what string should be exposed on UI.
That was my orginal function, what works on older version of firmwire.

function formatRhythmSelect(valueId, value)
  local intVal = math.floor(tonumber(value) or 0)
  
  -- 1. Obsługa nienaruszonego zakresu fabrycznego (0-13)
  if intVal <= 13 then
    return FIXED_BANK_NAMES[intVal] or "---"
  end
  
  -- 2. Logika dynamicznego wyliczania nazw dla kart EXP (14-65)
  local expIndex = intVal - 13 -- Uzyskujemy wirtualne przesunięcie (1, 2, 3...)
  local currentSum = 0
  
  if type(JV.system.detectedCards) == "table" then
    for i = 1, 8 do
      local cardId = JV.system.detectedCards[i]
      if cardId then
        local cardDef = EXP_CARD_RHYTHM_MAP[cardId]
        if cardDef and cardDef.sets > 0 then
          -- Sprawdzamy, czy szukany bank leży w obrębie tej karty
          if expIndex <= (currentSum + cardDef.sets) then
            local localBankNum = expIndex - currentSum
            if cardDef.sets == 1 then
              return cardDef.name
            else
              return string.format("%s %02d", cardDef.name, localBankNum)
            end
          end
          currentSum = currentSum + cardDef.sets
        end
      end
    end
  end
  
  -- Zwrot w przypadku braku fizycznej karty w slocie (Zgodnie z planem do testów <<No Media>>)
  return string.format("EXP [B:%02d]", expIndex)
end

I was trying to update it for new firmwire where i changed using two arguments, to one. Debugger seems like everything is fine in that function, when i set propertly value, i have propertly feedback from debugger, but on electra nothing change.

function formatRhythmSelect(value)

  local raw = value:getValue()

  local intVal = math.floor(tonumber(raw) or 0)

  local result



  if intVal <= 13 then

    result = FIXED_BANK_NAMES\[intVal\] or "---"

  else

    local expIndex = intVal - 13

    local currentSum = 0

    local found = false

    if type(JV.system.detectedCards) == "table" then

      for i = 1, 8 do

        local cardId = JV.system.detectedCards\[i\]

        if cardId then

          local cardDef = EXP_CARD_RHYTHM_MAP\[cardId\]

          if cardDef and cardDef.sets > 0 then

            if expIndex <= (currentSum + cardDef.sets) then

              local localBankNum = expIndex - currentSum

              if cardDef.sets == 1 then

                result = cardDef.name

              else

                result = string.format("%s %02d", cardDef.name, localBankNum)

              end

              found = true

              break

            end

            currentSum = currentSum + cardDef.sets

          end

        end

      end

    end

    if not found then

      result = string.format("EXP \[B:%02d\]", expIndex)

    end

  end



  print("\[FMT\] raw=" .. tostring(raw) .. " -> '" .. tostring(result) .. "'")

  return result

end

Also much simpler format functions, for dials, are working fully propertly:


function efxFormat1(v)

  if isParsingSysex or isEngineRefreshing or isRefresingEFX then return "---" end

  return efxParamFormat(v, 1)

end

I’ve nothing changed in json code between versions of presets, on older presets every formatter for list objects stop working propertly. On some controls i have defined text overlays, on some totally not, but i need to set range, for working, even there’s no text in them, so json automatically make “value”: and “label”: in control structure, i’m afraid it will always overwrite formatter labels, but i’m not sure about that. I think, there’s something wrong with that, and i have a lot of work with other problems, so i decided to write this post.

Anyway, working on new firmwire is much more pleasant and smoother, much added options are honey for me. I’m really satisfied with that!

I will review that. From what you describe it looks like there is a regression - if going back to 4.1.4 resolves that. Thanks for reporting!

I found the problem and fixed it. I have a few other things to fix/review. I will try to make 5.0.4 tonight with all that work in it.

I am very happy to hear that you used the debugger! In this case the problem was at the very last step when the firmware renders the list - the list text value had higher priority than the formatter output - an issue introduced in the new firmware.

3 Likes

Like i was thinking, that’s compare with my observations.
I need to say one more thing, but i’m not sure about that, so don’t want to make other topic. I think there’s issue with my preset’s on the website. I usually make duplicate for working preset’s, and actually working on clone, if something goes really wrong, i’m going back to original script, but sometimes i see, one more clone in my preset’s and that’s strange. That’s not really bad problem, but there’s second time, where original script are overwrited with bugs from clone, i was trying to come back to original preset’s and have this same bugs, and that’s really bad. I don’t see any overwriting in revisions, and i was late to see any changes on lua script, because i usually deleting clones, when something goes really wrong. I’m not sure about that, maybe that’s something wrong in my previous edits, but i have impression this happend second time in last day, and don’t have something like that before. I will try to trace it next time and will add more informations if that’s really true.

there is 5.0.4 available for download on beta.electra.one. Can you give it a try? For me, it resolves the issue with formatters (when used with the list controls).

to use beta, go to htttps://beta.electra.one/ and use your standard login credentials. Note, use beta for testing only, do not use it for real work.

1 Like

formatters working right now propertly

1 Like

Meh. I wanted to use larger Font on displayed value on item list, that’s really nice added option in new firmwire, and was thinking, when i use formatter this Font Size will be displayed as i set it on the layout, but it come back to standard size. I didn’t find any way to set it with Lua script. That’s something what You thinking about before? Font Weight has this same “issue”…or just not implemented yet of course. Just little optical experiments here.

I was not able to reproduce this one. Font settings seem to be applied with/without formatter.Tried 5.0.3 and the latest beta.

1 Like