From 75f5ce7d7e517dac5b5e1786e19db3e361cfbe5d Mon Sep 17 00:00:00 2001 From: shinichi Date: Wed, 9 Sep 2020 20:47:45 +0200 Subject: [PATCH] checksum fix dumbest reason ever (maybe) --- ProftaakRH/BLEHandler.cs | 9 +++++---- ProftaakRH/Main.cs | 9 --------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/ProftaakRH/BLEHandler.cs b/ProftaakRH/BLEHandler.cs index f9ce1f7..5854cf8 100644 --- a/ProftaakRH/BLEHandler.cs +++ b/ProftaakRH/BLEHandler.cs @@ -139,16 +139,17 @@ namespace Hardware { antMessage[i] = 0xFF; } - //antMessage[10] = (byte)Math.Max(Math.Min(Math.Round(percentage / 0.5), 255), 0); - antMessage[11] = 100; //hardcoded for testing + antMessage[11] = (byte)Math.Max(Math.Min(Math.Round(percentage / 0.5), 255), 0); + //antMessage[11] = 50; //hardcoded for testing byte checksum = 0; - for (int i = 0; i < antMessage.Length; i++) + for (int i = 0; i < 12; i++) { checksum ^= antMessage[i]; } - antMessage[12] = checksum; + //antMessage[12] = checksum;// no because dumb reasons. it is somehow always 0x39 ?!?!?!? magic i tell you!(or a bug:D) + antMessage[12] = 0x39; bleBike.WriteCharacteristic("6E40FEC3-B5A3-F393-E0A9-E50E24DCCA9E", antMessage); diff --git a/ProftaakRH/Main.cs b/ProftaakRH/Main.cs index 3cd5d1f..93ed7f2 100644 --- a/ProftaakRH/Main.cs +++ b/ProftaakRH/Main.cs @@ -22,16 +22,7 @@ namespace ProftaakRH Thread.Yield(); } - Console.WriteLine("odlodlJNgeojhtosj\n/nng;sjonghjsngl;zdf\nnhgLLBJHS\nEOGHSFJBNSLDFJSLDFJGHOAIJo;r\njnAJFVBHHBRG"); - bLEHandler.setResistance(50); - bLEHandler.setResistance(50); - bLEHandler.setResistance(50); - bLEHandler.setResistance(50); - bLEHandler.setResistance(50); - bLEHandler.setResistance(50); - - Console.ReadLine(); } }