@@ -702,6 +702,7 @@ namespace bitbot
702702 {
703703 getCode ( )
704704 sendCommand2 ( PIDENABLE , 1 ) // first access to BitBot PRO, so ensure PID loop is enabled
705+ sendCommand3 ( STARTPWM , 35 , 18 ) // set m+start PWM values to lowest sensible. NB pwmMax is always doubled before use
705706 }
706707 return versionCode
707708 }
@@ -1243,7 +1244,7 @@ namespace bitbot
12431244 {
12441245 if ( angle < 0 )
12451246 {
1246- angle = - angle
1247+ angle = - angle + 2 // Always seems to lose a couple of degrees at the start. Slipping?
12471248 speed = - speed
12481249 }
12491250 sendCommand4 ( SPINANGLE , ( direction == BBRobotDirection . Right ) ? - speed : speed , angle & 0xff , angle >> 8 )
@@ -1318,15 +1319,15 @@ namespace bitbot
13181319 if ( isPRO ( ) && ! pidActive )
13191320 {
13201321 radius = Math . max ( radius , 7 )
1321- // if(getFirmwareCode() == 11) // v11 firmware incorrectly limits max speed, so do it here for all versions
1322+ // if(getFirmwareCode() == 11) // v11 firmware incorrectly limited max speed, so do it here for all versions
13221323 {
13231324 let spdMin = ( 30 * radius ) / ( radius - 5.38 ) // 30 is minimum speed before clamping, 5.38 is half width between wheels
13241325 let spdMax = ( 100 * radius ) / ( radius + 5.38 )
13251326 speed = clamp ( speed , spdMin , spdMax )
13261327 }
13271328
13281329 // fudge the angle to correct for speed and radius variances
1329- angle = angle * ( 1.0 + ( speed - 20 ) / ( Math . max ( radius / 35.0 , 1.0 ) * 1000.0 ) )
1330+ // angle = angle * (1.0 + (speed-20)/(Math.max(radius/35.0, 1.0) * 1000.0))
13301331
13311332 let aSpeed = ( ( direction == BBArcDirection . ReverseLeft ) || ( direction == BBArcDirection . ReverseRight ) ) ? - speed : speed
13321333 let aAngle = ( ( direction == BBArcDirection . ForwardRight ) || ( direction == BBArcDirection . ReverseRight ) ) ? - angle : angle
@@ -1578,6 +1579,7 @@ namespace bitbot
15781579 //% weight=50
15791580 //% subcategory="BitBot PRO"
15801581 //% group=Advanced
1582+ //% deprecated=true
15811583 export function setStartPWM ( pwmMin : number , pwmMax : number ) : void
15821584 {
15831585 if ( isPRO ( ) )
0 commit comments