aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Stendahl <jakob.stendahl@outlook.com>2021-02-24 13:06:28 +0100
committerJakob Stendahl <jakob.stendahl@outlook.com>2021-02-24 13:06:28 +0100
commitdfabc6f837023ac4aaade2fddaa98a3a6777391e (patch)
treef60d270962605904e0b596428aa40aa34e56ede5
parent0542fca68a768426cd9338f014b8b19a21d507d9 (diff)
downloadhoverbit-ble-dfabc6f837023ac4aaade2fddaa98a3a6777391e.tar.gz
hoverbit-ble-dfabc6f837023ac4aaade2fddaa98a3a6777391e.zip
:art: Change (*uBit).prop to uBit->prop
-rw-r--r--source/HoverBitController.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/source/HoverBitController.cpp b/source/HoverBitController.cpp
index 9860b43..fc4c51b 100644
--- a/source/HoverBitController.cpp
+++ b/source/HoverBitController.cpp
@@ -44,16 +44,16 @@ void HoverBitController::init(MicroBit* _uBit) {
roll = 0;
yaw = 0;
throttle = 0;
- lastReceiveTime = (*uBit).systemTime();
+ lastReceiveTime = uBit->systemTime();
/* I am not completly sure what this does, but it seems to me like this is
putting the air:bit board in some kind of "bind-mode", on the spec-sheet
there isn't any documentation for what 20 pulses means tho... */
- (*uBit).sleep(100);
+ uBit->sleep(100);
int o;
for (o = 0; o < 20; o++) {
AirBit(-90, 0, 90, 0, 90, 0, 0);
- (*uBit).sleep(20);
+ uBit->sleep(20);
}
}
@@ -61,7 +61,7 @@ void HoverBitController::init(MicroBit* _uBit) {
* This is not implemented yet.
*/
bool HoverBitController::failSafe(void) {
- unsigned long deltaReceiveTime = (*uBit).systemTime() - lastReceiveTime;
+ unsigned long deltaReceiveTime = uBit->systemTime() - lastReceiveTime;
if (deltaReceiveTime > FSAFE_TLIM_THROTTLE) {
Throttle(0);
Rudder(0);
@@ -80,7 +80,7 @@ bool HoverBitController::failSafe(void) {
unsigned int HoverBitController::GetBatteryVoltage() {
float batteryFactor = 4.42;
int batteryMilliVolt = 3700;
- return ((float)((&(*uBit).io.P0)->getAnalogValue()) * batteryFactor * 0.05) + ((float)batteryMilliVolt * 0.95);
+ return ((float)((&uBit->io.P0)->getAnalogValue()) * batteryFactor * 0.05) + ((float)batteryMilliVolt * 0.95);
}
/**
@@ -143,7 +143,7 @@ void HoverBitController::AirBit(int Pitch,int Arm,int Roll,int Throttle,int Yaw,
buf[13] = aux1S & 255;
buf[14] = (6 << 2) | ((aux2S >> 8) & 3);
buf[15] = aux2S & 255;
- (*uBit).serial.send(buf, 16, SYNC_SPINWAIT);
+ uBit->serial.send(buf, 16, SYNC_SPINWAIT);
}
/**
@@ -162,7 +162,7 @@ void HoverBitController::Throttle(int _throttle) {
if (_throttle > 99) { throttle = 100; }
else if (_throttle < 0) { throttle = 0; }
else { throttle = _throttle; }
- lastReceiveTime = (*uBit).systemTime();
+ lastReceiveTime = uBit->systemTime();
}
int HoverBitController::Rudder() {
// The AirBit uses the roll parameter to control the hoverbit's rudder.
@@ -173,14 +173,14 @@ void HoverBitController::Rudder(int _rudder) {
if (_rudder > 90) { roll = 90; }
else if (_rudder < -90) { roll = -90; }
else { roll = _rudder; }
- lastReceiveTime = (*uBit).systemTime();
+ lastReceiveTime = uBit->systemTime();
}
bool HoverBitController::Arm() {
return (arm == 1);
}
void HoverBitController::Arm(bool _arm) {
arm = (int)_arm;
- lastReceiveTime = (*uBit).systemTime();
+ lastReceiveTime = uBit->systemTime();
}
bool HoverBitController::BatteryEmpty() {
return batteryEmpty;