projects:mihab:ultracode
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
projects:mihab:ultracode [2007/06/25 21:37] – created laurenceb | projects:mihab:ultracode [2008/07/19 23:33] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | < | + | < |
' ************************ IMPORTANT!!!!! | ' ************************ IMPORTANT!!!!! | ||
' * Use these values in BASCOM at " | ' * Use these values in BASCOM at " | ||
Line 26: | Line 26: | ||
Declare Sub Updatepredict() | Declare Sub Updatepredict() | ||
Declare Sub Cutdown() | Declare Sub Cutdown() | ||
+ | Declare Sub Landingvideo() | ||
Dim Temp1 As Byte , Temp2 As Byte , | Dim Temp1 As Byte , Temp2 As Byte , | ||
Line 32: | Line 33: | ||
Dim Jordancurveypoints(18) As Single | Dim Jordancurveypoints(18) As Single | ||
Dim Numberofpoints As Byte | Dim Numberofpoints As Byte | ||
+ | Dim Videookay As Byte | ||
Dim G As Byte , De As Byte , Cutdown As Byte | Dim G As Byte , De As Byte , Cutdown As Byte | ||
Line 67: | Line 69: | ||
Dim Deltae As Single , Deltan As Single , Deltaa As Single , Deltat As Single | Dim Deltae As Single , Deltan As Single , Deltaa As Single , Deltat As Single | ||
Dim Averagealt As Single | Dim Averagealt As Single | ||
+ | Dim Cuttingdown As Eram Byte | ||
Open " | Open " | ||
Line 114: | Line 116: | ||
| | ||
| | ||
+ | | ||
' | ' | ||
Line 128: | Line 131: | ||
Config Clock = Soft | Config Clock = Soft | ||
Config Portd.0 = Input | Config Portd.0 = Input | ||
+ | Config Watchdog = 2048 | ||
I2cinit | I2cinit | ||
Line 147: | Line 151: | ||
' | ' | ||
+ | Stop Watchdog | ||
+ | | ||
Print #1 , "Hello from ULTRAHAB" | Print #1 , "Hello from ULTRAHAB" | ||
Wait 1 | Wait 1 | ||
- | $include " | + | $include " |
$include " | $include " | ||
Line 163: | Line 169: | ||
Print #1 , "Card setup okay" | Print #1 , "Card setup okay" | ||
End If | End If | ||
- | Print #1 , " | ||
- | | ||
- | | ||
- | | ||
Print #1 , "sms time" | Print #1 , "sms time" | ||
S = "hello test" | S = "hello test" | ||
Line 191: | Line 193: | ||
Call Updatepredict() | Call Updatepredict() | ||
Temp1 = Checkposition(predictede , Predictedn) | Temp1 = Checkposition(predictede , Predictedn) | ||
- | Print #1 , "ckeck says:" ; Temp1 | + | Print #1 , "check says:" ; Temp1 |
Print #1 , "press the button you fool!!!!" | Print #1 , "press the button you fool!!!!" | ||
For Temp1 = 1 To 10 ' | For Temp1 = 1 To 10 ' | ||
Line 201: | Line 203: | ||
Iterations = 241 | Iterations = 241 | ||
Print #4 , " | Print #4 , " | ||
- | Print #11 , "bad news: forced reeboot, cutting down" | + | Print #1 , "bad news: forced reeboot, cutting down" |
+ | Wait 4 | ||
+ | If Cuttingdown = 15 Then | ||
+ | Print #4 , " | ||
+ | Print #1 , "not enought power!!!" | ||
+ | | ||
+ | End If | ||
Goto Theflightloop: | Goto Theflightloop: | ||
Userpresent: | Userpresent: | ||
+ | If Cuttingdown <> 0 Then | ||
+ | | ||
+ | End If | ||
Print #1 , " | Print #1 , " | ||
Print #1 , "FAT Start Sector: " ; Glfatfirstsector | Print #1 , "FAT Start Sector: " ; Glfatfirstsector | ||
Line 222: | Line 233: | ||
Wend | Wend | ||
- | Open "verbos.txt" For Input As #14 | + | Open "VERB.TXT" For Input As #14 |
Do | Do | ||
Do | Do | ||
Line 231: | Line 242: | ||
Input #1 , B | Input #1 , B | ||
Loop Until B = " | Loop Until B = " | ||
- | Kill " | ||
Close #14 | Close #14 | ||
- | Open "gps.txt" For Input As #14 | + | Kill " |
+ | |||
+ | |||
+ | Open "LOG.TXT" For Input As #14 | ||
Do | Do | ||
Do | Do | ||
Line 242: | Line 255: | ||
Input #1 , B | Input #1 , B | ||
Loop Until B = " | Loop Until B = " | ||
- | Kill " | ||
- | Close #14 | ||
- | Open " | ||
- | Do | ||
- | Do | ||
- | Line Input #14 , S ' | ||
- | Print #1 , S ' | ||
- | Loop Until Eof(#14) <> 0 | ||
- | Print #1 , " | ||
- | Input #1 , B | ||
- | Loop Until B = " | ||
- | Kill " | ||
Close #14 | Close #14 | ||
+ | Kill " | ||
+ | Print #1 , " | ||
+ | | ||
+ | | ||
+ | | ||
Line 260: | Line 266: | ||
Theflightloop: | Theflightloop: | ||
Do | Do | ||
- | Open "verbos.txt" For Append As #11 'these are all our files | + | Open "VERB.TXT" For Append As #11 'these are all our files |
- | Open "gps.txt" For Append As #12 | + | Open "LOG.TXT" For Append As #12 |
- | Open " | + | |
Incr Iterations | Incr Iterations | ||
Print #1 , "Main loop iteration number:" | Print #1 , "Main loop iteration number:" | ||
Line 269: | Line 274: | ||
| | ||
Call Onewiretemperature() | Call Onewiretemperature() | ||
- | Print #10 , Seconds ; " | + | Print #12 , Seconds ; "," |
Print #11 , " | Print #11 , " | ||
Wait 30 | Wait 30 | ||
Line 276: | Line 281: | ||
B = Mid(s , 2 , 6) 'check stuff and update | B = Mid(s , 2 , 6) 'check stuff and update | ||
Loop Until B = " | Loop Until B = " | ||
+ | S = Mid(s , 2 , 90) | ||
Print #11 , S | Print #11 , S | ||
Print #12 , S | Print #12 , S | ||
Call Processgps() | Call Processgps() | ||
Call Updatepredict() | Call Updatepredict() | ||
+ | If Deltaa < 0 And Videookay = 1 And Altitude < 300 Then | ||
+ | Call Landingvideo() | ||
+ | End If | ||
Print #11 , " | Print #11 , " | ||
Call Sendsms() | Call Sendsms() | ||
Line 295: | Line 304: | ||
Print #4 , " | Print #4 , " | ||
End If | End If | ||
- | If Iterations > 240 Then | + | If Iterations > 180 Then ' |
Print #1 , "Time limit cutdown" | Print #1 , "Time limit cutdown" | ||
Print #11 , "Time limit cutdown" | Print #11 , "Time limit cutdown" | ||
Line 306: | Line 315: | ||
| | ||
Call Onewiretemperature() | Call Onewiretemperature() | ||
+ | Print #12 , Seconds ; "," | ||
+ | Print #11 , " | ||
Wait 10 'video | Wait 10 'video | ||
- | Call Video(6) | + | Call Video(8) |
Wait 10 | Wait 10 | ||
Do | Do | ||
Line 313: | Line 324: | ||
B = Mid(s , 2 , 6) | B = Mid(s , 2 , 6) | ||
Loop Until B = " | Loop Until B = " | ||
+ | S = Mid(s , 2 , 90) | ||
Print #11 , S | Print #11 , S | ||
Print #12 , S | Print #12 , S | ||
Call Processgps() | Call Processgps() | ||
Call Updatepredict() | Call Updatepredict() | ||
+ | If Deltaa < 0 And Videookay = 1 And Altitude < 300 Then | ||
+ | Call Landingvideo() | ||
+ | End If | ||
Print #11 , " | Print #11 , " | ||
- | Call Sendsms() | ||
Print #4 , " | Print #4 , " | ||
If Cutdown = 0 Then | If Cutdown = 0 Then | ||
Line 334: | Line 348: | ||
End If | End If | ||
Close #11 | Close #11 | ||
- | Close #10 | ||
Close #12 | Close #12 | ||
+ | |||
Loop | Loop | ||
Line 366: | Line 380: | ||
K = 0.90909 * K | K = 0.90909 * K | ||
K = Roottwomgovercda * K 'we now have the velocity of decent | K = Roottwomgovercda * K 'we now have the velocity of decent | ||
+ | Print #1 , " | ||
K = Deltaa / K 'time of decent for this layer | K = Deltaa / K 'time of decent for this layer | ||
+ | Print #1 , " | ||
K = K / Deltat | K = K / Deltat | ||
+ | Print #1 , "Layer weighting=" | ||
+ | K = K + 1 ' | ||
Deltae = K * Deltae | Deltae = K * Deltae | ||
Deltan = K * Deltan | Deltan = K * Deltan | ||
Line 373: | Line 391: | ||
Predictede = Predictede + Deltae | Predictede = Predictede + Deltae | ||
End If | End If | ||
- | Print #1 , "preidcted | + | Print #1 , "predicted |
Print #1 , " | Print #1 , " | ||
End Sub | End Sub | ||
Line 416: | Line 434: | ||
Print #1 , " | Print #1 , " | ||
Print #1 , " | Print #1 , " | ||
+ | If Altitude > 500 Then | ||
+ | Videookay = 1 | ||
+ | End If | ||
End Sub | End Sub | ||
Line 595: | Line 616: | ||
End Sub | End Sub | ||
+ | Sub Landingvideo() | ||
+ | Print #1 , " | ||
+ | Videookay = 0 | ||
+ | Toggle Cam_right | ||
+ | Waitms 200 | ||
+ | Toggle Cam_right | ||
+ | Waitms 300 | ||
+ | Toggle Cam_right | ||
+ | Waitms 200 | ||
+ | Toggle Cam_right | ||
+ | Waitms 200 | ||
+ | Toggle Cam_ok | ||
+ | Waitms 200 | ||
+ | Toggle Cam_ok | ||
+ | Waitms 500 | ||
+ | Toggle Cam_shutter | ||
+ | Waitms 200 | ||
+ | Toggle Cam_shutter | ||
+ | End Sub | ||
' | ' | ||
Line 601: | Line 640: | ||
Sub Cutdown() | Sub Cutdown() | ||
Print #1 , " | Print #1 , " | ||
+ | | ||
+ | Start Watchdog | ||
| | ||
- | Wait 12 | + | For Temp1 = 1 To 12 |
+ | Wait 1 | ||
+ | Reset Watchdog | ||
+ | Next Temp1 | ||
| | ||
- | | + | |
+ | Stop Watchdog | ||
+ | | ||
End Sub | End Sub | ||
projects/mihab/ultracode.1182807443.txt.gz · Last modified: 2008/07/19 23:31 (external edit)