Information on Nwazet Display Go! module
#1
Posted 12 April 2012 - 01:50 AM
#2
Posted 12 April 2012 - 02:24 AM
#3
Posted 12 April 2012 - 06:19 AM
#4
Posted 12 April 2012 - 06:26 AM
Are pictures other than bitmaps supported?
Yes: raw 16-bit / pixel bitmaps.
3. Is it possible to display serial video, say mJpeg or H.264 at a relatively low frame rate?
If you can convert mpeg frames or H.264 frame to raw 16-bit bit streams, you can, even though the frame rate will be limited by the bandwidth provided by SPI as well as the size of the (8KB) buffer currently used. Nothing prevents you from tuning the firmware for your application (Ah! The beauty of OSS !)
Cheers,
-Fabien.
#5
Posted 13 April 2012 - 03:31 AM
I want to be able to send temperatures and information to the display instead of the output screen.
I have start to port pieces from C# (NwazetDisplayModule program) to Visual Basic but have run into problems declaring and using the Font to be used.
My code so far is:
Imports System Imports System.IO Imports System.Threading Imports Microsoft.SPOT Imports Microsoft.SPOT.Hardware Imports SecretLabs.NETMF.Hardware.NetduinoGo Imports Nwazet.Go.Helpers Imports Nwazet.Go.Fonts Imports Nwazet.Go.Imaging Imports Nwazet.Go.Display.TouchScreen Namespace Basic_go_display Public Module Module1 Dim ColorBackground As Integer = BasicColor.Black Dim lastTouchX As Integer Dim lastTouchY As Integer Public ReadOnly CornerStyle As VirtualCanvas.RoundedCornerStyle = VirtualCanvas.RoundedCornerStyle.All Public Sub Main() Dim canvas = New VirtualCanvas(AddressOf TouchEventHandler, AddressOf WidgetClickedHandler) Debug.Print(Resources.GetString(Resources.StringResources.String1)) Debug.EnableGCMessages(True) Debug.Print("Available RAM: " + Debug.GC(True).ToString() + " bytes.") Debug.EnableGCMessages(False) canvas.Initialize(GoSockets.Socket5) canvas.TouchscreenCalibration() BasicTouchEventTest(canvas) canvas.Reboot() canvas.Dispose() End Sub Public Sub TouchEventHandler(ByVal touchEvent As TouchEvent) Debug.Print("------------TouchEventHandler------------") Debug.Print("X: " & touchEvent.X.ToString) Debug.Print("Y: " & touchEvent.Y.ToString) Debug.Print("Pressure: " & touchEvent.Pressure.ToString) lastTouchX = touchEvent.X lastTouchY = touchEvent.Y End Sub Public Sub WidgetClickedHandler(ByVal widget As Widget, ByVal touchEvent As TouchEvent) End Sub Public Sub BasicTouchEventTest(ByVal canvas As VirtualCanvas) Dim message = "Josh Clean the Kitchen!" Dim fontInfo As Font = New VerdanaBold14.GetFontInfo Dim stringLength As UShort = fontInfo.GetStringWidth(message) canvas.SetOrientation(VirtualCanvas.Orientation.Landscape) canvas.DrawFill(CUShort(ColorBackground)) canvas.DrawString(CUShort(canvas.Width - stringLength) / 2, canvas.Height / 2, CUShort (BasicColor.Blue), fontInfo.ID, message) canvas.TouchscreenWaitForEvent() canvas.DrawCircleFilled(lastTouchX, lastTouchY, 4, CUShort(BasicColor.Red)) canvas.Execute() canvas.SetOrientation(VirtualCanvas.Orientation.Portrait) Thread.Sleep(1000) End Sub End Module End NamespaceI am getting the following errors (3 currently):
1 Value of type 'Basic_go_display.VerdanaBold14.GetFontInfo' cannot be converted to 'Microsoft.SPOT.Font'.
Program.vb 48 30 Basic go display
3 'ID' is not a member of 'Microsoft.SPOT.Font'. Program.vb 52 112 Basic go display
2 'GetStringWidth' is not a member of 'Microsoft.SPOT.Font'. Program.vb 49 36 Basic go display
I have visual basic code using the Onboard Button, Button Module, RGB Led Module, Potentiometer Module.
It is still pretty basic (no pun intended) but the button cycles through 7 colors and off with the
Pot controlling the brightness of the LED.
Imports System.Threading Imports NetduinoGo Imports SecretLabs.NETMF.Hardware.NetduinoGo Imports GoBus Module Module1 Sub Main() Dim Led As RgbLed = New RgbLed Dim PB As Button = New Button 'Dim PB As InputPort = New InputPort(Pins.Button, True, Port.ResistorMode.Disabled)'Onboard 'Button Dim Pot As Potentiometer = New Potentiometer Dim i As Integer = 0 Dim ColorValue As Byte While True ColorValue = CByte(255 * Pot.GetValue) If PB.ButtonState Then i = i + 1 If i > 7 Then i = 0 End If Thread.Sleep(250)' prevents button bounce between colors End If Thread.Sleep(100)' slows sample rate of the poteniometer. Select Case i Case 0 Led.SetColor(0, 0, 0) ' off Case 1 Led.SetColor(ColorValue, 0, 0) ' red Case 2 Led.SetColor(0, ColorValue, 0) ' green Case 3 Led.SetColor(0, 0, ColorValue) ' blue Case 4 Led.SetColor(ColorValue, ColorValue, 0) ' yellow Case 5 Led.SetColor(0, ColorValue, ColorValue) ' cyan Case 6 Led.SetColor(ColorValue, 0, ColorValue) ' purple Case 7 Led.SetColor(ColorValue, ColorValue, ColorValue) ' white End Select End While End Sub End ModuleThanks for any help,
Chuck
#6
Posted 13 April 2012 - 08:29 AM
#7
Posted 14 April 2012 - 12:28 AM
#8
Posted 14 April 2012 - 12:41 AM
I don't think the errors you are seeing have anything to do with your using VB. You are more likely missing references.
I belive that you are correct, I still haven't found the location in the C# files that contain the font definitions, it looks like the calls are going to Microsoft.SPOT.Font instead of where it is supposed to go.
I will keep looking for it.
Thanks Bertrand,
Chuck
#9
Posted 14 April 2012 - 12:55 AM
#10
Posted 14 April 2012 - 02:19 AM
Thanks Fabien,Carb,
So you know, I'm not using anything that has to do with Micorsoft.SPOT.Font.
The font definitions in the C# code are only used to track the variables sizes of the characters in each font.
The actual fonts are in the display's firmware. This makes things very efficient for display as the C# code only passes a font ID to reference a given font when needed.
Hope it helps.
-Fabien.
I got it to work, some of the problem I had after I got the code right was with the referrence path for the .PE files. I took the file names that my program couldn't find, searched for them on the drive. I picked the file that was used by your program, Checked the Properties, and Put that path into the Reference Path (C:/...debug/) at first I included the /le. When I looked at the error it had C:/.../le/LE/ so I went back to c:/.../Debug/.
The code that works is:
Imports System Imports System.IO Imports System.Threading Imports Microsoft.SPOT Imports Microsoft.SPOT.Hardware Imports SecretLabs.NETMF.Hardware.NetduinoGo Imports Nwazet.Go.Helpers Imports Nwazet.Go.Fonts Imports Nwazet.Go.Imaging Imports Nwazet.Go.Display.TouchScreen Namespace Basic_go_display Public Module Module1 Public ReadOnly ColorBackground As UShort = CUShort(BasicColor.Blue) Dim lastTouchX As Integer Dim lastTouchY As Integer Public Sub Main() Dim canvas = New VirtualCanvas(AddressOf TouchEventHandler, AddressOf WidgetClickedHandler) Debug.Print(Resources.GetString(Resources.StringResources.String1)) Debug.EnableGCMessages(True) Debug.Print("Available RAM: " + Debug.GC(True).ToString() + " bytes.") Debug.EnableGCMessages(False) canvas.Initialize(GoSockets.Socket5) canvas.TouchscreenCalibration() BasicTouchEventTest(canvas) canvas.Reboot() canvas.Dispose() End Sub Public Sub TouchEventHandler(ByVal touchEvent As TouchEvent) Debug.Print("------------TouchEventHandler------------") Debug.Print("X: " & touchEvent.X.ToString) Debug.Print("Y: " & touchEvent.Y.ToString) Debug.Print("Pressure: " & touchEvent.Pressure.ToString) lastTouchX = touchEvent.X lastTouchY = touchEvent.Y End Sub Public Sub WidgetClickedHandler(ByVal widget As Widget, ByVal touchEvent As TouchEvent) End Sub Public Sub BasicTouchEventTest(ByVal canvas As VirtualCanvas) Dim message = "Josh Clean the Kitchen!" Dim fontInfo = New Verdana14().GetFontInfo() Dim stringLength = fontInfo.GetStringWidth(message) canvas.SetOrientation(VirtualCanvas.Orientation.Landscape) canvas.DrawFill(CUShort(ColorBackground)) canvas.DrawString(CUShort((canvas.Width - stringLength) / 2), CUShort(canvas.Height / 2), CUShort(BasicColor.White), fontInfo.ID, message) canvas.TouchscreenWaitForEvent() canvas.Execute() canvas.SetOrientation(VirtualCanvas.Orientation.Portrait) End Sub End Module End NamespaceI got a lot of help in the code translation from this link http://converter.telerik.com/
It will convert from C# to VB.Net or VB.Net to C#. It saved me a lot of reading and headaches.
I still have some warnings of a possible overflow without an exception, but for what I am doing it should not occur.
Thanks for the help,
Chuck
#11
Posted 15 April 2012 - 04:26 PM
I came up with another question.
Currently I am using canvas.Initialize(GoSockets.Socket4) to Initialize the Nwazet Display Module. Is there a way to Initialize the display without specifing the socket to be used?
I want to be able to plug in the display module and let the Netduino Go main board find the display module.
Thanks,
Chuck
#12
Posted 16 April 2012 - 12:36 AM
Is there a way to Initialize the display without specifing the socket to be used?
Nope: to initialize a module you must have a socket associated with it.
I want to be able to plug in the display module and let the Netduino Go main board find the display module.
That's a different thing: you could send an SPI query identical to the one used in canvas.Initialize() to retrieve the module's ID and take it from there if it corresponds to the display.
What is the scenario for doing this?
#13
Posted 16 April 2012 - 12:55 AM
Thanks for the reply Fabien,Hi Charles,
Nope: to initialize a module you must have a socket associated with it.
That's a different thing: you could send an SPI query identical to the one used in canvas.Initialize() to retrieve the module's ID and take it from there if it corresponds to the display.
What is the scenario for doing this?
It is not a particular problem, I just thought that with the exception of the Shield Base (only while still in beta) you could plug any module into any of the sockets.
But if I understand you correctly you need to hard code the LCD display module to a given socket.
I looked for a way to have it figure out which socket it was plugged into but could not find one.
Chuck
#14
Posted 16 April 2012 - 03:25 AM
#15
Posted 19 April 2012 - 07:09 PM
Twiiter: https://twitter.com/Gutworks
#16
Posted 21 April 2012 - 05:38 PM
There isn't one in this revision of the module and here's why: the ILI9341 IC driver of the display I'm using does have a PWM backlight control circuit that is configurable through software commands (Write Display Brightness (51h) page 141 of the datasheet). The manufacturer of the display omitted to connect it to the backlight I discovered this when the module board was already in production as I was focusing on the finishing touches of the driver. At that point, it was too late to change the design. The display manufacturer recognized the omission and did say that they would correct the mistake in a future revision of the display.
-Fabien.
#17
Posted 21 April 2012 - 06:45 PM
#18
Posted 21 April 2012 - 07:33 PM
SD cards modules aren't available yet but it's easy to connect one
http://fabienroyer.w...ng-out-sockets/
http://fabienroyer.w...-to-a-netduino/
I'm surprised to hear that the demo 'crashes' because the 2 places where the SD is referenced use a try / catch :
public static void BmpImageTest(VirtualCanvas canvas) { try { var sd = new SDCardReader(); sd.Initialize(GoSockets.Socket8); DisplayBmpPicture(canvas, @"Nwazet\03.bmp"); DisplayBmpPicture(canvas, @"Nwazet\05.bmp"); DisplayBmpPicture(canvas, @"Nwazet\09.bmp"); canvas.SetOrientation(Orientation.Landscape); DisplayBmpPicture(canvas, @"Nwazet\00.bmp"); DisplayBmpPicture(canvas, @"Nwazet\01.bmp"); DisplayBmpPicture(canvas, @"Nwazet\02.bmp"); DisplayBmpPicture(canvas, @"Nwazet\04.bmp"); DisplayBmpPicture(canvas, @"Nwazet\06.bmp"); DisplayBmpPicture(canvas, @"Nwazet\07.bmp"); DisplayBmpPicture(canvas, @"Nwazet\08.bmp"); sd.Dispose(); }catch(Exception e){ Debug.Print(e.Message); Debug.Print("You need an SD card loaded with the demo photos to run this part of the demo."); } }
Here's the output when running w/o an SD card reader
Available RAM: 88380 bytes.
A first chance exception of type 'System.IO.IOException' occurred in SecretLabs.NETMF.IO.dll
SD Card or file I/O error: manual calibration required.
A first chance exception of type 'System.ApplicationException' occurred in Nwazet.Go.SD.dll
socket already bound
You need an SD card loaded with the demo photos to run this part of the demo.
<...>
Which specific line did you comment out? I'll gladly update the demo code if I can repro the issue.
Cheers,
-Fabien.
#19
Posted 27 April 2012 - 04:40 PM
#20
Posted 27 April 2012 - 05:33 PM
1) If I do a touch calib in debug mode and capture the calibration matrix, can it be "good enough" for other displays? I bought two and tested this and at least with these two, the calibration profiles seem to work.
private static void CalibrateTouchScreen() { byte[] calib=new byte[33]{0 ,0 ,3 ,0 ,33 ,0 ,5 ,229 ,192 ,0 ,0 ,1 ,128 ,174 ,6 ,50 ,80 ,255 ,255 ,133 ,0 ,0 ,7 ,133 ,128 ,148 ,104 ,208 ,64 ,255 ,177 ,35 ,14 }; // change to =null or new byte[0] to get initial calibration if (calib != null && calib.Length > 0) { BasicTypeDeSerializerContext b = new BasicTypeDeSerializerContext(calib); var matrix = new CalibrationMatrix(); matrix.Get(B); Screen.SetTouchscreenCalibrationMatrix(matrix); } else { Screen.TouchscreenCalibration(); var matrix = Screen.GetTouchscreenCalibrationMatrix(); if (matrix != null) { BasicTypeSerializerContext b = new BasicTypeSerializerContext(); matrix.Put(B); int x; calib = b.GetBuffer(out x); // break point here in debug mode and view calib } } }
2) How do you poll for a touch event so you don't block your main thread? I tried
Screen.TouchscreenWaitForEvent(); Screen.Execute(Synchronicity.Asynchronous);Which seems to work the very first time, but doesn't get any touch events after that.
static int CenterX=240/2; static int CenterY=320/2; static int CirleRadius=240/4; static BasicColor BottomColor=BasicColor.White; static BasicColor TopColor=BasicColor.Green; private static void ScreenTouched(object o, TouchEvent e) { if(BottomColor==BasicColor.White) BottomColor=BasicColor.Blue; else BottomColor=BasicColor.White; Screen.DrawCircleFilled(CenterX, CenterY+CircleRadius, CircleRadius, (ushort)BottomColor); } public static void Main() { Screen.Initialize(GoSockets.Socket1); CalibrateTouchScreen(); Screen.SetOrientation(Orientation.Portrait); Screen.DrawFill((ushort)BasicColor.Black); Screen.Execute(); while(true) { Screen.TouchscreenWaitForEvent(); Screen.Execute(Synchronicity.Asynchronous); // if I get rid of Asynchronous, it blocks here if(TopColor==BasicColor.Green) TopColor=BasicColor.Red; else TopColor=BasicColor.Green; Screen.DrawCircleFilled(CenterX, CenterY-CircleRadius, CircleRadius, (ushort)TopColor); Screen.Execute(); } }3) GetStringWidth may be broken on different fonts. Verdana9 seems to be offset 20 pixels too far to the left when I try this, but Verdana14 works perfectly.
Screen.SetOrientation(Orientation.Portrait); Screen.DrawFill((ushort)BasicColor.Black); string Message="Center Test"; int ScreenWidth=240; FontInfo TextFont = new Verdana9().GetFontInfo(); Screen.DrawString((ScreenWidth / 2) - (TextFont.GetStringWidth(Message) / 2), 0, (ushort)BasicColor.Red, TextFont.ID, Message); TextFont = new Verdana14().GetFontInfo(); Screen.DrawString((ScreenWidth / 2) - (TextFont.GetStringWidth(Message) / 2), 100, (ushort)BasicColor.White, TextFont.ID, Message);
..I'm sure I'll come up with some other questions, but that's all I have before lunch. Adoring how simple it is to make really cool stuff.
Edited by Stefan, 27 April 2012 - 05:53 PM.
Added [code] tags
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users