Patch for Button module

Hi all!

At the end of October, I downloaded the SDK from GHI Electronics site, Support – GHI Electronics, and it was dated Oct. 7, 2011. With that version, the Button module had a problem that prevented the ButtonPressed event to be raised. In fact, I had to download the patch available at http://www.tinyclr.com/forum/21/4373/ to make it work. It that post, it was said that the patch will be deleted when the fix will be included in the next version of SDK.

Today I need to install the SDK on a new PC, so I go to the Support – GHI Electronics page again and notice that SDK is always dated Oct. 7, 2011. In fact, as I read on http://tinyclr.com/forum/12/5117/, the new SDK is still in beta.

Seems that in this moment I can’t use the stable version of .NET Gadgeteer SDK available from Support – GHI Electronics, if I want to use the Button module. Or this version has been updated with the fix?

As always, thanks for the attention!

Hi Marco,

take a look at this thread:
http://tinyclr.com/forum/21/5106/

Thank you for the response!

It the post you suggest, there is a reference to the http://tinyclr.com/forum/12/5117 page, that I have already checked and that contains the link to the Beta SDK.

In fact, in the last reply of the topic, Jimmy JoeBob Alooba says that “When I manually extracted the files from the GHI NETMF v4.1 SDK.msi that came in the latest SDK, I found that it contained the 6 Oct file set.”

I would like to understand if the current stable version of .NET Gadgeteer SDK, available at Support – GHI Electronics, contains the fix for the Button module, because it has been deleted from new known issues topic.

AFAIK the SDK from the support page
DOES NOT
contain the fix.
Only the Beta SDK so far…

OK… But this means that, if I want the Button module to work properly, I must use the SDK beta? It seems very strange…

hm…
no
the Beta SDK is newer than the one offered at the support page.
if the Beta SDK turns final, the SDK at the support page will be replaced.

the official released on is beta and the one we just release privately on forum is also beta.

Gadgeteer altogether is couple months old so all is in beta :slight_smile:

OK, now the situation is clear.

A last question: do you have an idea of when the support page will be updated with the new version of SDK?

Thanks!

When we add wifi fix.

Perfect, thanks again!

Trying the “Getting started with FEZ Spider” with the beta SDK, using the “Surveillance Camera” code example, it crashes in program.Run() when I press the button (after the led turns on), saying that in System.NullReferenceException an exception of type “GTM.GHIElectronics.Button.dll” occured, which isn’t done in the user code.

Is this a known issue ?

yes. there is a patch available. it is not part of the main SDK yet.

Try the SDK release on this forum. Look under beta

I’m already using the beta from http://tinyclr.com/forum/12/5117/ :slight_smile:

Moreover, I’m also having a lot of Camera ERROR messages since the update, but at least the button is now responding. And yes, I’ve also started a new project after updating the SDK. Files are dated 12.12.2011.

Details please. What is “a lot of problems”?

Doing a Camera.TakePicture(), sleeping for 2000ms, I’m getting about 1 out of 10 pictures. For the rest, I’m getting “Camera ERROR : Unable to take picture. The camera is already busy taking a picture.”.
Even increasing to 5000ms doesn’t make it any better.

Also as said, the code crashes everytime I press the button.

There is a problem with the way this driver handles events. The exception occurs on the Up (Released)event. Until the next SDK, make sure you have an event handler assigned to both the Up (Released) and Down (Pressed) events. This is completely fine and should solve your issue for now.

void button_ButtonReleased(Button sender, Button.ButtonState state)
        {
            
        }

Also, try this. Take out all of the calls to Sleep, and instead, check to see is the camera is ready to take a picture.

void button_ButtonPressed(Button sender, Button.ButtonState state)
        {
            Debug.Print("Button Pressed. Attempting to take picture.");

            if (camera.CameraReady == true)
                camera.TakePicture();
            else
                Debug.Print("Camera is still busy.");
        }

Doing Sleep inside events (interrupt handlers) is terribly bad for the system.

Gus : Well, in fact it was a timer, but it didn’t work at least in the end.

Steven : Many thanks, that fixed the button issue. The camera only works for 5 shots, then it stops. Maybe the camera is broken (Version 1.1), I’m going to get another one.

I might be ot, but is there OneWire support planned for FEZ Spider ?

I dont think there is a problem with the camera if it can take any pictures at all. Maybe its in how you are using the camera? Could you post more about what you are doing in your program?