Open rsam70 opened 6 years ago
Hi,
Which C# API are you using? I cannot tell from the methods you're using. It looks sort of like "Blink1Lib" and not "ManagedBlink1", but I don't see a PlayPattern()
method in "Blink1Lib".
Hello Tod,
Thx for you reaction. Btw I think this is a VERY useful application!.
Below is the stack we basically use.
blink1-cs.dll (Managed Blink lib) in here are the calls [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
hid.dll.
We are using vs2017 c++17 C#4.7.1 all latest greatest. (64 bit compilation)
When doing the same calls sometimes only 1 LED is lid. This is realy confusing for people who use this as a diagnosis tool.
Additional questions 1) Is it possible to program the flash with the following sequence solid red 2 sec off 2 sec (endless). I can now only do a fade to transition. 2) The initial startup sequence ( fading red to blue to green to white) was probably fun to flash that, is there a way to overrule that behaviour?
Thx in advance
Ruud Sampers
2018-03-22 18:39 GMT+01:00 Tod E. Kurt notifications@github.com:
Hi, Which C# API are you using? I cannot tell from the methods you're using. It looks sort of like "Blink1Lib" and not "ManagedBlink1", but I don't see a PlayPattern() method in "Blink1Lib".
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/todbot/blink1/issues/327#issuecomment-375395442, or mute the thread https://github.com/notifications/unsubscribe-auth/AEh4oCPh_Y997iubr9iKL-GmYjaXDCBYks5tg-HsgaJpZM4S27sd .
I am currently experiencing this problem. My app is using the Blink1 C# API and hidlibrary v3.2.46 in a .NET 4.6.1 app.
The issue occurs from a fresh start-up or after resuming from sleep* with the device already connected. From this point on, calls to SetColor() still affect both LEDs but, calls to PlayPreset() affect only 1 LED. The issue is resolved when removing and re-attaching the Blink(1) device.
*I suspect that the "demo mode" (blue, red, green cycle), which appears to occur when the device is plugged in while not in communication with the OS/driver, might be the cause of the issue... perhaps it leaves the device in a state which the C# API doesn't reset/clear.
Hi @laurencedobson, A few questions:
SetColor()
commands and no others?SetColor()
calls to FadeToColor(10,...)
? (This should be visually the same)blink1-control.exe --fwversion
(As for which C# API, I normally suggest people use the Sleddog.Blink1 on NuGet just because it's 100% .NET (no C library dependency) and it's in a package manager. Second choice would be our ManagedBlink1 library since it's also 100% .NET.)
Hi @todbot. Thanks for getting back to me. Answers to your questions:
SetColor()
to set the device to a solid white (idle) color. Then I use SavePreset()
to fill up each of the 32 available presets and PlayPreset(0)
to make the device flash alerts id:0 - firmware:204 serialnum:XXXXXXXX (mk2)
I note that, when using Blink1Control.exe, everything works as expected. When I then exit and run my app instead, the symptoms still persist.
Follow-up for 3: Substituting SetColor()
with FadetoColor()
appears to have made no difference - either solution lights both LEDs correctly and calling SavePreset()
and PlayPreset()
still exhibits lighting on a single LED.
While poking around with the command-line tool, blink1-tool.exe
, I have found that writing my pattern to the flash memory (overwriting the default alternating pattern) prevents the issue from occurring on future system start-ups. This seems to suggest that saving a pattern to the device which contains led switching might be the root cause, presumably because the .NET library doesn't specify which LED to light when writing patterns to it.
On a device exhibiting this issue, the pattern being written to it is different. Here's what I did...
blink1-tool.exe --readpattern
The output is:
{0,#000078,0.50,1,#00c832,0.50,1,#000078,0.50,1,#00c832,0.50,1,#000078,0.50,1,#00c832,0.50,1,#000078,0.50,1,#00c832,0.50,1,#000078,0.50,1,#00c832,0.50,1,#000078,0.50,1,#00c832,0.50,1,#000078,0.50,1,#00c832,0.50,1,#000078,0.50,1,#00c832,0.50,1,#000078,0.50,1,#00c832,0.50,1,#000078,0.50,1,#00c832,0.50,1,#000078,0.50,1,#00c832,0.50,1,#000078,0.50,1,#00c832,0.50,1,#000078,0.50,1,#00c832,0.50,1,#000078,0.50,1,#00c832,0.50,1,#000078,0.50,1,#00c832,0.50,1,#000078,0.50,1,#00c832,0.50,1}
The pattern uses 1 (which denotes LED 1 only)
blink1-tool.exe --readpattern
Output:
{0,#000078,0.50,0,#00c832,0.50,0,#000078,0.50,0,#00c832,0.50,0,#000078,0.50,0,#00c832,0.50,0,#000078,0.50,0,#00c832,0.50,0,#000078,0.50,0,#00c832,0.50,0,#000078,0.50,0,#00c832,0.50,0,#000078,0.50,0,#00c832,0.50,0,#000078,0.50,0,#00c832,0.50,0,#000078,0.50,0,#00c832,0.50,0,#000078,0.50,0,#00c832,0.50,0,#000078,0.50,0,#00c832,0.50,0,#000078,0.50,0,#00c832,0.50,0,#000078,0.50,0,#00c832,0.50,0,#000078,0.50,0,#00c832,0.50,0,#000078,0.50,0,#00c832,0.50,0,#000078,0.50,0,#00c832,0.50,0}
This time, the pattern is set to uses 0 (denoting both LEDs).
Additionally, while exhibiting the issue, using blink1-tool.exe to play the pattern on a specific LED results in the pattern playing on LED 1, regardless of which LED I specify. Therefore, each of the following commands produces the same result:
blink1-tool.exe --play 1,0 -l 0
blink1-tool.exe --play 1,0 -l 1
blink1-tool.exe --play 1,0 -l 2
I realised that what I needed was a way to specify the LED number via the .NET library, so...
hardware/firmware_mk2/main.c
(https://github.com/todbot/blink1/blob/master/hardware/firmware_mk2/main.c)Set ledn
@ line 486SetLED()
in blink1/windows/ManagedBlink1/Blink1/Blink1.cs
which does the necessary hidlibrary
communication with the blink(1) deviceSavePreset()
function to take an additional ledn
parameter and call the new SetLED()
function prior to saving the preset to the deviceNow, ensuring the device was still exhibiting the issue, I then ran the new code to set the pattern and play it... AND IT WORKED :)
I'll get the changes put into a PR for you.
Platform Windows 10, using c# API.
For diagnose purposes we use solid(blinking) red,use solid(blinking) green, use solid(blinking) blue, off.
It sometimes happens that only 1 LED is on whilest expected to be Both on. folowing code snippet