Button.Pressed Event isn't firing in Fez Cream

I know the example shows a timer looking for a button.ispressed state, but I also noticed that the button has a pressed event defined in the Fez Cream intellisense. Is it a known issue that it never fires the event?

       
private void ProgramStarted()
        {
            this.button.Pressed += Button_Pressed;

            this.timer = new DispatcherTimer();
            this.timer.Interval = TimeSpan.FromMinutes(1);
            this.timer.Tick += Timer_Tick;
            this.timer.Start();
        }

        private void Button_Pressed(GTM.Button sender, object args)
        {
            CheckMoisture();
        }

        private void Timer_Tick(object sender, object e)
        {
            CheckMoisture();
        }

The timer calls the function fine, the button press event never does.

Not sure how to debug that, but I did turn the button’s LED on during app startup to at least confirm that it is active.

I noticed that the pressed event doesn’t fire, but the released event did. I just shrugged and used the release event. Guess I should have looked at that closer - it may well be broken code in the driver.

1 Like

@ Squeebee - We will take a look and let you know what we find.

@ Squeebee - This should be fixed. You can find the fixed version on our Bitbucket. To quickly fix, remove the if line (keep the this.valueChanged?.. line) from OnValueChanged in SocketInterfaces.cs under the Gadgeteer core.

1 Like

@ John - Awesome, thanks!