| 
														
															@@ -177,6 +177,7 @@ type 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     stopit: boolean;
 
														 | 
														
														 | 
														
															     stopit: boolean;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     activeFile: string;
 
														 | 
														
														 | 
														
															     activeFile: string;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     dirty: boolean;
 
														 | 
														
														 | 
														
															     dirty: boolean;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    function readString(var line: string): boolean;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     procedure saveSection(filename: string; key: string);
 
														 | 
														
														 | 
														
															     procedure saveSection(filename: string; key: string);
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     procedure loadSection(filename: string; key: string);
 
														 | 
														
														 | 
														
															     procedure loadSection(filename: string; key: string);
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
 
														 | 
														
														 | 
														
															 
 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -749,63 +750,10 @@ end; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
 
														 | 
														
														 | 
														
															 
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 function TForm1.serialUpload: string;
 
														 | 
														
														 | 
														
															 function TForm1.serialUpload: string;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 var
 
														 | 
														
														 | 
														
															 var
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  hexFileSource: TStringList;
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  hexFile, tmp, line: string;
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  pos, x: integer;
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  hexFile: string;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 begin
 
														 | 
														
														 | 
														
															 begin
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  pos := 0;
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  line := '';
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   hexFile := MCSIO.CreateUniqueFile(MCSIO.GetTempDir, 'TPS', '.hex');
 
														 | 
														
														 | 
														
															   hexFile := MCSIO.CreateUniqueFile(MCSIO.GetTempDir, 'TPS', '.hex');
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   makeHexFile(hexFile);
 
														 | 
														
														 | 
														
															   makeHexFile(hexFile);
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-{  hexFileSource := TStringList.Create;
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  for x := 1 to StringGrid1.RowCount - 1 do
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  begin
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    if (pos = 0) then
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    begin
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-      line := line + ':';
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    end;
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    tmp := StringGrid1.Cells[1, x];
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    line := line + tmp;
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    tmp := StringGrid1.Cells[2, x];
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    line := line + tmp;
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    Inc(pos);
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    if (pos = 8) then
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    begin
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-      hexFileSource.Add(line);
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-      line := '';
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-      pos := 0;
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    end
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    else
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    begin
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-      line := line + ',';
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    end;
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  end;
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  if (pos = 0) then
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  begin
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    line := hexFileSource.Strings[hexFileSource.Count - 1];
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    hexFileSource.Delete(hexFileSource.Count - 1);
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    pos := 8;
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  end;
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  if (pos <= 7) then
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  begin
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    for x := pos to 7 do
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    begin
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-      line := line + '00';
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-      if (x < 7) then
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        line := line + ',';
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    end;
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  end;
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  line := line + '*';
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  hexFileSource.Add(line);
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  MCSIO.StrToFile(hexFile, hexFileSource.Text);
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  hexFileSource.Free;
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-}
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   Result := hexFile;
 
														 | 
														
														 | 
														
															   Result := hexFile;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 end;
 
														 | 
														
														 | 
														
															 end;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
 
														 | 
														
														 | 
														
															 
 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -827,8 +775,11 @@ var 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   KeyName, StringValue: string;
 
														 | 
														
														 | 
														
															   KeyName, StringValue: string;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   Res: WideString;
 
														 | 
														
														 | 
														
															   Res: WideString;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   Lines: TStringList;
 
														 | 
														
														 | 
														
															   Lines: TStringList;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  TimeOut: integer;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  error: boolean;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
 
														 | 
														
														 | 
														
															 
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 begin
 
														 | 
														
														 | 
														
															 begin
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  error := False;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   line := GetSerialPortNames;
 
														 | 
														
														 | 
														
															   line := GetSerialPortNames;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   //  if (line <> '') then
 
														 | 
														
														 | 
														
															   //  if (line <> '') then
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   begin
 
														 | 
														
														 | 
														
															   begin
 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -853,24 +804,62 @@ begin 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       SdpoSerial1.Device := comService;
 
														 | 
														
														 | 
														
															       SdpoSerial1.Device := comService;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       SdpoSerial1.Active := True;
 
														 | 
														
														 | 
														
															       SdpoSerial1.Active := True;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
 
														 | 
														
														 | 
														
															 
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-      Lines := TStringList.Create;
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-      Lines.LoadFromFile(hexFile);
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-      for x := 0 to Lines.Count - 1 do
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      if (not readString(line)) then
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      begin
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        error := True;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      end;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      if (not error) then
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      begin
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        SdpoSerial1.WriteData('w');
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if (readString(line)) then
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        begin
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+          if (pos('ready', line) > 0) then
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+          begin
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            Lines := TStringList.Create;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            Lines.LoadFromFile(hexFile);
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            for x := 0 to Lines.Count - 1 do
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            begin
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+              SdpoSerial1.WriteData(Lines.Strings[x]);
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+              SdpoSerial1.WriteData(CRLF);
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+              Sleep(250);
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            end;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            SdpoSerial1.WriteData('e');
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+          end
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+          else
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+          begin
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            error := True;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+          end;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        end;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      end;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      if (error) then
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       begin
 
														 | 
														
														 | 
														
															       begin
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        SdpoSerial1.WriteData(Lines.Strings[x]);
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        SdpoSerial1.WriteData(CRLF);
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        Application.MessageBox('Arduino antwortet nicht. Evtl. Arduino nicht angeschlossen oder falsche Firmware?',
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+          'Keine Antwort',
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+          MB_OK + MB_ICONEXCLAMATION);
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       end;
 
														 | 
														
														 | 
														
															       end;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       SdpoSerial1.Active := False;
 
														 | 
														
														 | 
														
															       SdpoSerial1.Active := False;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       DeleteFile(hexFile);
 
														 | 
														
														 | 
														
															       DeleteFile(hexFile);
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     end;
 
														 | 
														
														 | 
														
															     end;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   end;
 
														 | 
														
														 | 
														
															   end;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-{  else
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+end;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+function TForm1.readString(var line: string): boolean;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+var
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  TimeOut: integer;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+begin
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  Result := False;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  TimeOut := 10;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  while ((not SdpoSerial1.DataAvailable) and (TimeOut > 0)) do
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  begin
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    Dec(TimeOut);
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    Sleep(1000);
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  end;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  if (Timeout > 0) then
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   begin
 
														 | 
														
														 | 
														
															   begin
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    Application.MessageBox('Kein Comport vorhanden. EVt. Arduino nicht angeschlossen?',
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-      'Kein Comport',
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-      MB_OK + MB_ICONEXCLAMATION);
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    line := SdpoSerial1.ReadData;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    Result := True;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   end;
 
														 | 
														
														 | 
														
															   end;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  }
 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 end;
 
														 | 
														
														 | 
														
															 end;
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
 
														 | 
														
														 | 
														
															 
 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 procedure TForm1.setDirty(Value: boolean);
 
														 | 
														
														 | 
														
															 procedure TForm1.setDirty(Value: boolean);
 
														 |