Author Topic: Those damn semaphore timeouts...again!  (Read 148 times)

garry23

  • Contributor
  • Hero Member
  • *****
  • Posts: 1957
Those damn semaphore timeouts...again!
« on: January 13, 2020, 07:34:12 PM »
I've tried to work out what is going 'wrong' with my latest DOFI code.

It is a simple code that generates repetitive semaphore messages, but I can't work out why.

The relevant code snippet looks like this:

Code: [Select]
function check_stuff()
    if menu.get("Focus","DOF Info") == "ON" then show = true else show = false end
    if (lv.overlays == 2 and (not menu.visible)) and show then update() end
    return true
end

DOFI_Menu = menu.new
{
    parent = "Focus",
    name = "DOF Info",
    help = "Helps with infinity focusing & focus bracketing",
    depends_on = DEPENDS_ON.LIVEVIEW,
    choices = {CON,COFF},
}

lv.info
{
    name = "DOFI",
    value = "",
    priority = 100,
    update = function(this)
        if (not show) then
            this.value = ""
        else
            this.background = COLOR.WHITE
            this.foreground = COLOR.BLACK
            if image_taken then
                if (x == last_x) then
                    this.background = COLOR.YELLOW
                    this.foreground = COLOR.BLACK
                elseif (ndof > last_fdof) or (fdof < last_ndof) then
                    this.background = COLOR.RED
                    this.foreground = COLOR.WHITE
                elseif (ndof < last_ndof) and (fdof > last_ndof) then
                    this.background = COLOR.GREEN1
                    this.foreground = COLOR.BLACK
                elseif (ndof > last_ndof) and (ndof <= last_fdof) then
                    this.background = COLOR.GREEN1
                    this.foreground = COLOR.BLACK
                end

                if x > infinity then
                    this.value = "INF"
                    this.background = COLOR.BLACK
                    this.foreground = COLOR.WHITE
                else
                    this.value = blurs
                end
            else
                this.value = blurs
            end
        end
    end
}

event.shoot_task = check_stuff

The semaphore is related to the menu, but why do I get it?

Does anyone have any insight?