[chronojump] chronopic.cs reads chars (not lines) from new automatic firmware config
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] chronopic.cs reads chars (not lines) from new automatic firmware config
- Date: Fri, 12 Sep 2014 13:00:55 +0000 (UTC)
commit 9078d74e71644387132a76496f2de09aee2034c4
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Sep 12 15:00:13 2014 +0200
chronopic.cs reads chars (not lines) from new automatic firmware config
src/chronopic.cs | 33 +++++++++++++++++++--------------
1 files changed, 19 insertions(+), 14 deletions(-)
---
diff --git a/src/chronopic.cs b/src/chronopic.cs
index 04cf793..48e87cb 100644
--- a/src/chronopic.cs
+++ b/src/chronopic.cs
@@ -154,41 +154,46 @@ Console.Write("4");
//for "automatic" firmware 1.1: debounce can change, get version, port scanning
public void Read_variables_automatic()
{
- Console.Write(" ReadVarAutoStart ");
+ Console.WriteLine("---------------------------");
+ Console.WriteLine("ReadVarAutoStart");
if (sp == null)
sp.Open();
- Console.Write(" ReadVarAutoOpened ");
-
- //byte[] answer = new byte[1];
-
- Console.WriteLine("---------------------------");
+ Console.WriteLine("ReadVarAutoOpened");
sp.Write("V");
- Console.WriteLine("Version: " + sp.ReadLine());
+ Console.WriteLine("Version: " +
+ (char) sp.ReadByte() +
+ (char) sp.ReadByte() +
+ (char) sp.ReadByte()
+ );
sp.Write("J");
- Console.WriteLine("Port scanning (should return 'J'): " + sp.ReadLine());
+ Console.WriteLine("Port scanning (should return 'J'): " + (char) sp.ReadByte());
+
+ int debounce = 0;
sp.Write("a");
- Console.WriteLine("debounce time (need to *10): " + sp.ReadLine());
+ debounce = ( sp.ReadByte() - '0' ) * 10;
+ Console.WriteLine("\nCurrent debounce time: " + debounce.ToString());
- Console.WriteLine("Changing to 10 ms");
+ Console.WriteLine("Changing to 10 ms ... ");
sp.Write("b\x01");
sp.Write("a");
- Console.WriteLine("debounce time (need to *10): " + sp.ReadLine());
+ debounce = ( sp.ReadByte() - '0' ) * 10;
+ Console.WriteLine("Current debounce time: " + debounce.ToString());
- Console.WriteLine("Changing to 50 ms");
+ Console.WriteLine("Changing to 50 ms ... ");
sp.Write("b\x05");
sp.Write("a");
- Console.WriteLine("debounce time (need to *10): " + sp.ReadLine());
+ debounce = ( sp.ReadByte() - '0' ) * 10;
+ Console.WriteLine("Current debounce time: " + debounce.ToString());
Console.WriteLine("---------------------------");
- Console.Write(" ReadVarAutoEnd ");
}
//----------------------------------------
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]