Changeset 15 for trunk


Ignore:
Timestamp:
04/08/10 10:38:19 (14 years ago)
Author:
pinwc4
Message:

Created more database methods and tweaked interface

Location:
trunk/desktop
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/desktop/ICSSerialPort.rbbas

    r11 r15  
    370370        #tag EndMethod 
    371371 
     372        #tag Method, Flags = &h0 
     373                Sub loadProfile(theName as string) 
     374                  //Find the profile in the database, update the bytes and fire the event 
     375                  dim rs as RecordSet 
     376                   
     377                  rs = fsicsdb.SQLSelect("SELECT * FROM carprofiles WHERE name= '"+theName+"'") 
     378                   
     379                  //Make sure we got a record to work with 
     380                  if rs <> Nil then 
     381                     
     382                    if rs.Field("cartype").StringValue <> "" then 
     383                      carType = rs.Field("cartype").StringValue 
     384                    end if 
     385                     
     386                    if rs.Field("byte01").StringValue <> "" then 
     387                      byte01 = chrb(rs.Field("byte01").IntegerValue) 
     388                    end if 
     389                    if rs.Field("byte02").StringValue <> "" then 
     390                      byte02 = chrb(rs.Field("byte02").IntegerValue) 
     391                    end if 
     392                    if rs.Field("byte03").StringValue <> "" then 
     393                      byte03 = chrb(rs.Field("byte03").IntegerValue) 
     394                    end if 
     395                    if rs.Field("byte04").StringValue <> "" then 
     396                      byte04 = chrb(rs.Field("byte04").IntegerValue) 
     397                    end if 
     398                    if rs.Field("byte05").StringValue <> "" then 
     399                      byte05 = chrb(rs.Field("byte05").IntegerValue) 
     400                    end if 
     401                    if rs.Field("byte06").StringValue <> "" then 
     402                      byte06 = chrb(rs.Field("byte06").IntegerValue) 
     403                    end if 
     404                    if rs.Field("byte07").StringValue <> "" then 
     405                      byte07 = chrb(rs.Field("byte07").IntegerValue) 
     406                    end if 
     407                    if rs.Field("byte08").StringValue <> "" then 
     408                      byte08 = chrb(rs.Field("byte08").IntegerValue) 
     409                    end if 
     410                    if rs.Field("byte09").StringValue <> "" then 
     411                      byte09 = chrb(rs.Field("byte09").IntegerValue) 
     412                    end if 
     413                    if rs.Field("byte10").StringValue <> "" then 
     414                      byte10 = chrb(rs.Field("byte10").IntegerValue) 
     415                    end if 
     416                    if rs.Field("byte11").StringValue <> "" then 
     417                      byte11 = chrb(rs.Field("byte11").IntegerValue) 
     418                    end if 
     419                    if rs.Field("byte12").StringValue <> "" then 
     420                      byte12 = chrb(rs.Field("byte12").IntegerValue) 
     421                    end if 
     422                    if rs.Field("byte13").StringValue <> "" then 
     423                      byte13 = chrb(rs.Field("byte13").IntegerValue) 
     424                    end if 
     425                    if rs.Field("byte14").StringValue <> "" then 
     426                      byte14 = chrb(rs.Field("byte14").IntegerValue) 
     427                    end if 
     428                    if rs.Field("byte15").StringValue <> "" then 
     429                      byte15 = chrb(rs.Field("byte15").IntegerValue) 
     430                    end if 
     431                    if rs.Field("byte16").StringValue <> "" then 
     432                      byte16 = chrb(rs.Field("byte16").IntegerValue) 
     433                    end if 
     434                    if rs.Field("byte17").StringValue <> "" then 
     435                      byte17 = chrb(rs.Field("byte17").IntegerValue) 
     436                    end if 
     437                    if rs.Field("byte18").StringValue <> "" then 
     438                      byte18 = chrb(rs.Field("byte18").IntegerValue) 
     439                    end if 
     440                     
     441                    valuesChanged() 
     442                  end if 
     443                End Sub 
     444        #tag EndMethod 
     445 
    372446 
    373447        #tag Hook, Flags = &h0 
     
    598672                        InitialValue="&hFF" 
    599673                        Type="String" 
     674                        EditorType="MultiLineEditor" 
    600675                #tag EndViewProperty 
    601676                #tag ViewProperty 
     
    603678                        Group="Behavior" 
    604679                        Type="String" 
     680                        EditorType="MultiLineEditor" 
    605681                #tag EndViewProperty 
    606682                #tag ViewProperty 
     
    608684                        Group="Behavior" 
    609685                        Type="String" 
     686                        EditorType="MultiLineEditor" 
    610687                #tag EndViewProperty 
    611688                #tag ViewProperty 
     
    613690                        Group="Behavior" 
    614691                        Type="String" 
     692                        EditorType="MultiLineEditor" 
    615693                #tag EndViewProperty 
    616694                #tag ViewProperty 
     
    618696                        Group="Behavior" 
    619697                        Type="String" 
     698                        EditorType="MultiLineEditor" 
    620699                #tag EndViewProperty 
    621700                #tag ViewProperty 
     
    623702                        Group="Behavior" 
    624703                        Type="String" 
     704                        EditorType="MultiLineEditor" 
    625705                #tag EndViewProperty 
    626706                #tag ViewProperty 
     
    628708                        Group="Behavior" 
    629709                        Type="String" 
     710                        EditorType="MultiLineEditor" 
    630711                #tag EndViewProperty 
    631712                #tag ViewProperty 
     
    633714                        Group="Behavior" 
    634715                        Type="String" 
     716                        EditorType="MultiLineEditor" 
    635717                #tag EndViewProperty 
    636718                #tag ViewProperty 
     
    638720                        Group="Behavior" 
    639721                        Type="String" 
     722                        EditorType="MultiLineEditor" 
    640723                #tag EndViewProperty 
    641724                #tag ViewProperty 
     
    643726                        Group="Behavior" 
    644727                        Type="String" 
     728                        EditorType="MultiLineEditor" 
    645729                #tag EndViewProperty 
    646730                #tag ViewProperty 
     
    648732                        Group="Behavior" 
    649733                        Type="String" 
     734                        EditorType="MultiLineEditor" 
    650735                #tag EndViewProperty 
    651736                #tag ViewProperty 
     
    653738                        Group="Behavior" 
    654739                        Type="String" 
     740                        EditorType="MultiLineEditor" 
    655741                #tag EndViewProperty 
    656742                #tag ViewProperty 
     
    658744                        Group="Behavior" 
    659745                        Type="String" 
     746                        EditorType="MultiLineEditor" 
    660747                #tag EndViewProperty 
    661748                #tag ViewProperty 
     
    663750                        Group="Behavior" 
    664751                        Type="String" 
     752                        EditorType="MultiLineEditor" 
    665753                #tag EndViewProperty 
    666754                #tag ViewProperty 
     
    668756                        Group="Behavior" 
    669757                        Type="String" 
     758                        EditorType="MultiLineEditor" 
    670759                #tag EndViewProperty 
    671760                #tag ViewProperty 
     
    673762                        Group="Behavior" 
    674763                        Type="String" 
     764                        EditorType="MultiLineEditor" 
    675765                #tag EndViewProperty 
    676766                #tag ViewProperty 
     
    678768                        Group="Behavior" 
    679769                        Type="String" 
     770                        EditorType="MultiLineEditor" 
    680771                #tag EndViewProperty 
    681772                #tag ViewProperty 
    682773                        Name="byte10" 
    683774                        Group="Behavior" 
     775                        Type="String" 
     776                        EditorType="MultiLineEditor" 
     777                #tag EndViewProperty 
     778                #tag ViewProperty 
     779                        Name="carType" 
     780                        Group="Behavior" 
     781                        InitialValue="MR-03" 
     782                        Type="String" 
     783                #tag EndViewProperty 
     784                #tag ViewProperty 
     785                        Name="mode" 
     786                        Group="Behavior" 
     787                        InitialValue="read" 
    684788                        Type="String" 
    685789                #tag EndViewProperty 
  • trunk/desktop/mainWindow.rbfrm

    r14 r15  
    5959      Cancel          =   "" 
    6060      Caption         =   "Write" 
    61       Default         =   True 
     61      Default         =   False 
    6262      Enabled         =   True 
    6363      Height          =   20 
     
    129129      Panels          =   "" 
    130130      Scope           =   0 
    131       SmallTabs       =   "" 
     131      SmallTabs       =   False 
    132132      TabDefinition   =   "Settings\rProfiles\rCar\rCustom" 
    133133      TabIndex        =   43 
     
    138138      Top             =   32 
    139139      Underline       =   "" 
    140       Value           =   1 
     140      Value           =   2 
    141141      Visible         =   True 
    142142      Width           =   637 
     
    957957            LockRight       =   "" 
    958958            LockTop         =   "" 
    959             Maximum         =   255 
     959            Maximum         =   10 
    960960            Minimum         =   1 
    961961            PageStep        =   20 
     
    26952695                Sub Open() 
    26962696                  StaticText_Version.Text = "Version " + str(app.NonReleaseVersion/100) 
     2697                   
     2698                  //Set the default car type 
     2699                  ICSSerialPort1.setCarType("MR-03") 
    26972700                End Sub 
    26982701        #tag EndEvent 
     
    27932796                  //Update punch 
    27942797                  Slider_Punch.Value = asc(ICSSerialPort1.Byte05) 
     2798                  EditField_Punch.Text = str(asc(ICSSerialPort1.Byte05)) 
    27952799                   
    27962800                  //Update DBAND 
     
    29202924                  //Update Steering Gain 
    29212925                  Slider_STGain.Value = asc(ICSSerialPort1.Byte16) 
     2926                  EditField_STGain.Text = str(asc(ICSSerialPort1.Byte16)) 
    29222927                   
    29232928                  //Update Throttle Gain 
    29242929                  Slider_THGain.Value = asc(ICSSerialPort1.Byte17) 
     2930                  EditField_THGain.Text = str(asc(ICSSerialPort1.Byte17)) 
    29252931                End Sub 
    29262932        #tag EndMethod 
     
    30463052        #tag EndEvent 
    30473053#tag EndEvents 
     3054#tag Events TabPanel1 
     3055        #tag Event 
     3056                Sub Change() 
     3057                  updateAdvancedScreen 
     3058                  updateCarScreen 
     3059                End Sub 
     3060        #tag EndEvent 
     3061#tag EndEvents 
    30483062#tag Events PopupMenu_Profile 
    30493063        #tag Event 
     
    30523066                    PushButton_SaveProfile.Visible = true 
    30533067                    PushButton_Delete.Visible = true 
     3068                    ICSSerialPort1.loadProfile(me.Text) 
    30543069                  end if 
    30553070                End Sub 
     
    30893104                Sub ValueChanged() 
    30903105                  ICSSerialPort1.Byte17 = chrb(me.Value) 
    3091                   EditField_THGain.Text = str(me.Value) 
     3106                  //Check to see if we need to update the edit field 
     3107                  //This prevents the edit field from triggering this event that then updates the edit field again 
     3108                  //Causing the cursor to move to the begginning of the editfield 
     3109                  if EditField_THGain.Text <> str(me.Value) then 
     3110                    EditField_THGain.Text = str(me.Value) 
     3111                  end if 
     3112                   
     3113                   
     3114                End Sub 
     3115        #tag EndEvent 
     3116#tag EndEvents 
     3117#tag Events EditField_THGain 
     3118        #tag Event 
     3119                Sub TextChange() 
     3120                  //Make sure we have a valid value if not then set it to something 
     3121                  if me.Text <> "" then 
     3122                    if val(me.Text) > 255 or val(me.Text) < 1 then 
     3123                      me.Text = "255" 
     3124                    end if 
     3125                  end if 
     3126                   
     3127                  dim d as double 
     3128                  dim i as integer 
     3129                  d = val(me.Text) 
     3130                  i = d 
     3131                  ICSSerialPort1.Byte17 = chrb(i) 
     3132                   
     3133                  Slider_THGain.Value = val(me.Text) 
    30923134                End Sub 
    30933135        #tag EndEvent 
     
    30973139                Sub ValueChanged() 
    30983140                  ICSSerialPort1.Byte16 = chrb(me.Value) 
    3099                   EditField_STGain.Text = str(me.Value) 
     3141                  //Check to see if we need to update the edit field 
     3142                  //This prevents the edit field from triggering this event that then updates the edit field again  
     3143                  //Causing the cursor to move to the begginning of the editfield 
     3144                  if EditField_STGain.Text <> str(me.Value) then 
     3145                    EditField_STGain.Text = str(me.Value) 
     3146                  end if 
     3147                End Sub 
     3148        #tag EndEvent 
     3149#tag EndEvents 
     3150#tag Events EditField_STGain 
     3151        #tag Event 
     3152                Sub TextChange() 
     3153                  //Make sure we have a valid value if not then set it to something 
     3154                  if me.Text <> "" then 
     3155                    if val(me.Text) > 255 or val(me.Text) < 1 then 
     3156                      me.Text = "255" 
     3157                    end if 
     3158                  end if 
     3159                   
     3160                  dim d as double 
     3161                  dim i as integer 
     3162                  d = val(me.Text) 
     3163                  i = d 
     3164                  ICSSerialPort1.Byte16 = chrb(i) 
     3165                   
     3166                  Slider_STGain.Value = val(me.Text) 
     3167                   
    31003168                   
    31013169                End Sub 
     
    32203288                Sub ValueChanged() 
    32213289                  ICSSerialPort1.Byte05 = chrb(me.Value) 
    3222                   EditField_Punch.Text = str(me.Value) 
    3223                    
     3290                  //Check to see if we need to update the edit field 
     3291                  //This prevents the edit field from triggering this event that then updates the edit field again 
     3292                  //Causing the cursor to move to the begginning of the editfield 
     3293                  if EditField_Punch.Text <> str(me.Value) then 
     3294                    EditField_Punch.Text = str(me.Value) 
     3295                  end if 
     3296                   
     3297                   
     3298                End Sub 
     3299        #tag EndEvent 
     3300#tag EndEvents 
     3301#tag Events EditField_Punch 
     3302        #tag Event 
     3303                Sub TextChange() 
     3304                  //Make sure we have a valid value if not then set it to something 
     3305                  if me.Text <> "" then 
     3306                    if val(me.Text) > 255 or val(me.Text) < 1 then 
     3307                      me.Text = "255" 
     3308                    end if 
     3309                  end if 
     3310                   
     3311                  dim d as double 
     3312                  dim i as integer 
     3313                  d = val(me.Text) 
     3314                  i = d 
     3315                  ICSSerialPort1.Byte05 = chrb(i) 
     3316                   
     3317                  Slider_Punch.Value = val(me.Text) 
    32243318                End Sub 
    32253319        #tag EndEvent 
Note: See TracChangeset for help on using the changeset viewer.