@@ -16,14 +16,31 @@ local inc = { x = function(val) x = x + val return x end, y = function(val) y =
1616local labels = {}
1717local fields = {}
1818
19+ local escProtocols = { [0 ] = " PWM" , " OS125" , " OS42" , " MSHOT" }
20+
21+ if apiVersion >= 1.020 then
22+ escProtocols [# escProtocols + 1 ] = " BRSH"
23+ end
24+ if apiVersion >= 1.031 then
25+ escProtocols [# escProtocols + 1 ] = " DS150"
26+ escProtocols [# escProtocols + 1 ] = " DS300"
27+ escProtocols [# escProtocols + 1 ] = " DS600"
28+ if apiVersion < 1.042 then
29+ escProtocols [# escProtocols + 1 ] = " DS1200"
30+ end
31+ if apiVersion >= 1.036 then
32+ escProtocols [# escProtocols + 1 ] = " PS1000"
33+ end
34+ end
35+
1936if apiVersion >= 1.031 and apiVersion <= 1.040 then
2037 fields [# fields + 1 ] = { t = " 32kHz Sampling" , x = x , y = inc .y (lineSpacing ), sp = x + sp , min = 0 , max = 1 , vals = { 9 }, table = { [0 ] = " OFF" , " ON" }, upd = function (self ) self .updateRateTables (self ) end }
2138end
2239
2340if apiVersion >= 1.016 then
2441 fields [# fields + 1 ] = { t = " Gyro Update" , x = x , y = inc .y (lineSpacing ), sp = x + sp , min = 1 , max = 32 , vals = { 1 }, table = {}, upd = function (self ) self .updatePidRateTable (self ) end }
2542 fields [# fields + 1 ] = { t = " PID Loop" , x = x , y = inc .y (lineSpacing ), sp = x + sp , min = 1 , max = 16 , vals = { 2 }, table = {} }
26- fields [# fields + 1 ] = { t = " Protocol" , x = x , y = inc .y (lineSpacing ), sp = x + sp , min = 0 , max = 9 , vals = { 4 }, table = { [ 0 ] = " OFF " , " OS125 " , " OS42 " , " MSHOT " , " BRSH " , " DS150 " , " DS300 " , " DS600 " , " DS1200 " , " PS1000 " } }
43+ fields [# fields + 1 ] = { t = " Protocol" , x = x , y = inc .y (lineSpacing ), sp = x + sp , min = 0 , max = # escProtocols , vals = { 4 }, table = escProtocols }
2744 fields [# fields + 1 ] = { t = " Unsynced PWM" , x = x , y = inc .y (lineSpacing ), sp = x + sp , min = 0 , max = 1 , vals = { 3 }, table = { [0 ] = " OFF" , " ON" } }
2845 fields [# fields + 1 ] = { t = " PWM Frequency" , x = x , y = inc .y (lineSpacing ), sp = x + sp , min = 200 , max = 32000 , vals = { 5 , 6 }, }
2946end
@@ -70,7 +87,7 @@ return {
7087 end
7188 end ,
7289 updateRateTables = function (self )
73- if self .values [9 ] == 0 then
90+ if ( self .values [9 ] or 0 ) == 0 then
7491 self .calculateGyroRates (self , 8 )
7592 self .calculatePidRates (self , 8 )
7693 elseif self .values [9 ] == 1 then
0 commit comments