@@ -342,99 +342,7 @@ private void lbl_devfw_Click(object sender, EventArgs e)
342
342
UpdateFWList ( ) ;
343
343
CMB_history . Visible = false ;
344
344
}
345
-
346
- private void lbl_px4io_Click ( object sender , EventArgs e )
347
- {
348
- CustomMessageBox . Show ( "Please save the px4io.bin file to your microsd card to insert into your px4." , "IO" ) ;
349
-
350
- var baseurl = "http://firmware.ardupilot.org/PX4IO/latest/PX4IO/px4io.bin" ;
351
-
352
- try
353
- {
354
- // Create a request using a URL that can receive a post.
355
- var request = WebRequest . Create ( baseurl ) ;
356
- request . Timeout = 10000 ;
357
- // Set the Method property of the request to POST.
358
- request . Method = "GET" ;
359
- // Get the request stream.
360
- Stream dataStream ; //= request.GetRequestStream();
361
- // Get the response.
362
- var response = request . GetResponse ( ) ;
363
- // Display the status.
364
- log . Info ( ( ( HttpWebResponse ) response ) . StatusDescription ) ;
365
- // Get the stream containing content returned by the server.
366
- dataStream = response . GetResponseStream ( ) ;
367
-
368
- var bytes = response . ContentLength ;
369
- var contlen = bytes ;
370
-
371
- var buf1 = new byte [ 1024 ] ;
372
-
373
- var fs =
374
- new FileStream (
375
- Path . GetDirectoryName ( Application . ExecutablePath ) + Path . DirectorySeparatorChar + @"px4io.bin" ,
376
- FileMode . Create ) ;
377
-
378
- lbl_status . Text = Strings . DownloadingFromInternet ;
379
-
380
- Refresh ( ) ;
381
- Application . DoEvents ( ) ;
382
-
383
- dataStream . ReadTimeout = 30000 ;
384
-
385
- while ( dataStream . CanRead )
386
- {
387
- try
388
- {
389
- progress . Value = 50 ;
390
- // (int)(((float)(response.ContentLength - bytes) / (float)response.ContentLength) * 100);
391
- progress . Refresh ( ) ;
392
- }
393
- catch
394
- {
395
- }
396
- var len = dataStream . Read ( buf1 , 0 , 1024 ) ;
397
- if ( len == 0 )
398
- break ;
399
- bytes -= len ;
400
- fs . Write ( buf1 , 0 , len ) ;
401
- }
402
-
403
- fs . Close ( ) ;
404
- dataStream . Close ( ) ;
405
- response . Close ( ) ;
406
-
407
- lbl_status . Text = "Done" ;
408
- Application . DoEvents ( ) ;
409
- }
410
- catch
411
- {
412
- CustomMessageBox . Show ( "Error receiving firmware" , Strings . ERROR ) ;
413
- return ;
414
- }
415
-
416
- using ( var sfd = new SaveFileDialog ( ) )
417
- {
418
- sfd . FileName = "px4io.bin" ;
419
- if ( sfd . ShowDialog ( ) == DialogResult . OK )
420
- {
421
- if ( sfd . FileName != "" )
422
- {
423
- if ( File . Exists ( sfd . FileName ) )
424
- File . Delete ( sfd . FileName ) ;
425
-
426
- File . Copy (
427
- Path . GetDirectoryName ( Application . ExecutablePath ) + Path . DirectorySeparatorChar +
428
- @"px4io.bin" , sfd . FileName ) ;
429
- }
430
- }
431
- }
432
-
433
- progress . Value = 100 ;
434
-
435
- CustomMessageBox . Show (
436
- "Please eject the microsd card, place into the px4, hold down the ioboard safety button, power on,\n and wait 60 seconds for the automated upgrade to take place.\n A upgrade status is created on your microsd card." ) ;
437
- }
345
+
438
346
439
347
private void lbl_dlfw_Click ( object sender , EventArgs e )
440
348
{
0 commit comments