Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
RTOS-Threads/src/Task1.cpp@36:d95e3d6f2fc4, 2014-05-13 (annotated)
- Committer:
- pHysiX
- Date:
- Tue May 13 04:05:34 2014 +0000
- Revision:
- 36:d95e3d6f2fc4
- Parent:
- 34:228d87c45151
- Child:
- 37:29feef05d848
Telemetry output completely changed; Code tidied
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| pHysiX | 22:ef8aa9728013 | 1 | /* File: Task1.cpp |
| pHysiX | 22:ef8aa9728013 | 2 | * Author: Trung Tin Ian HUA |
| pHysiX | 22:ef8aa9728013 | 3 | * Date: May 2014 |
| pHysiX | 36:d95e3d6f2fc4 | 4 | * Functions: Thread1: Telemetry output |
| pHysiX | 22:ef8aa9728013 | 5 | * Settings: 100Hz |
| pHysiX | 36:d95e3d6f2fc4 | 6 | * Timing: //1440us |
| pHysiX | 22:ef8aa9728013 | 7 | */ |
| pHysiX | 1:43f8ac7ca6d7 | 8 | #include "Task1.h" |
| pHysiX | 1:43f8ac7ca6d7 | 9 | #include "setup.h" |
| pHysiX | 1:43f8ac7ca6d7 | 10 | |
| pHysiX | 36:d95e3d6f2fc4 | 11 | bool box_demo = false; |
| pHysiX | 36:d95e3d6f2fc4 | 12 | bool rc_out = false; |
| pHysiX | 36:d95e3d6f2fc4 | 13 | bool gyro_out = false; |
| pHysiX | 36:d95e3d6f2fc4 | 14 | bool command_check = false; |
| pHysiX | 36:d95e3d6f2fc4 | 15 | bool adjust_check = false; |
| pHysiX | 33:f88a6ee18103 | 16 | |
| pHysiX | 34:228d87c45151 | 17 | |
| pHysiX | 34:228d87c45151 | 18 | |
| pHysiX | 34:228d87c45151 | 19 | |
| pHysiX | 36:d95e3d6f2fc4 | 20 | // ================= |
| pHysiX | 36:d95e3d6f2fc4 | 21 | // === TELEMETRY === |
| pHysiX | 36:d95e3d6f2fc4 | 22 | // ================= |
| pHysiX | 36:d95e3d6f2fc4 | 23 | void Task1(void const *argument) |
| pHysiX | 30:d9b988f8d84f | 24 | { |
| pHysiX | 36:d95e3d6f2fc4 | 25 | switch (box_demo) { |
| pHysiX | 36:d95e3d6f2fc4 | 26 | case true: |
| pHysiX | 36:d95e3d6f2fc4 | 27 | BT.printf("\nY%3.2f\nP%3.2f\nR%3.2f\n", ypr[0] - ypr_offset[0], ypr[1] - ypr_offset[1], ypr[2] - ypr_offset[2]); |
| pHysiX | 36:d95e3d6f2fc4 | 28 | BT.printf("\nA%3.2f\nT%2.2f\n", altimeter.Altitude_m(), altimeter.Temp_C()); |
| pHysiX | 30:d9b988f8d84f | 29 | |
| pHysiX | 36:d95e3d6f2fc4 | 30 | BT.printf("\nV%2.2f\n", voltageSense*VOLTAGE_SCALE); |
| pHysiX | 36:d95e3d6f2fc4 | 31 | break; |
| pHysiX | 36:d95e3d6f2fc4 | 32 | case false: |
| pHysiX | 36:d95e3d6f2fc4 | 33 | AHRSSample(); |
| pHysiX | 36:d95e3d6f2fc4 | 34 | break; |
| pHysiX | 36:d95e3d6f2fc4 | 35 | default: |
| pHysiX | 36:d95e3d6f2fc4 | 36 | break; |
| pHysiX | 36:d95e3d6f2fc4 | 37 | } |
| pHysiX | 30:d9b988f8d84f | 38 | |
| pHysiX | 36:d95e3d6f2fc4 | 39 | if (gyro_out) |
| pHysiX | 36:d95e3d6f2fc4 | 40 | BT.printf("%3d %3d %3d\n", (int) gyro[0], (int) gyro[1], (int) gyro[2]); |
| pHysiX | 30:d9b988f8d84f | 41 | |
| pHysiX | 36:d95e3d6f2fc4 | 42 | else if (rc_out) |
| pHysiX | 36:d95e3d6f2fc4 | 43 | BT.printf("%5d %5d %5d %5d %5d\n", RCCommand[0], RCCommand[1], RCCommand[2], RCCommand[3], RCCommand[4]); |
| pHysiX | 30:d9b988f8d84f | 44 | |
| pHysiX | 36:d95e3d6f2fc4 | 45 | else if (command_check) |
| pHysiX | 36:d95e3d6f2fc4 | 46 | BT.printf("%3d %3d %3d\n", inputYPR[0], inputYPR[1], inputYPR[2]); |
| pHysiX | 30:d9b988f8d84f | 47 | |
| pHysiX | 36:d95e3d6f2fc4 | 48 | else if (adjust_check) |
| pHysiX | 36:d95e3d6f2fc4 | 49 | BT.printf("%3.2f %3.2f %3.2f\n", adjust[0], adjust[1], adjust[2]); |
| pHysiX | 30:d9b988f8d84f | 50 | |
| pHysiX | 36:d95e3d6f2fc4 | 51 | else if (ESC_check) |
| pHysiX | 36:d95e3d6f2fc4 | 52 | BT.printf("%4d %4d %4d %4d\n", ESCpower[0], ESCpower[1], ESCpower[2], ESCpower[3]); |
| pHysiX | 30:d9b988f8d84f | 53 | |
| pHysiX | 36:d95e3d6f2fc4 | 54 | else {} |
| pHysiX | 36:d95e3d6f2fc4 | 55 | } |
| pHysiX | 31:3dde2201e54d | 56 | //Timer |