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.
Dependencies: mbed
Diff: CAN_asser.cpp
- Revision:
- 17:aae5361ddddf
- Parent:
- 16:05665faaa489
- Child:
- 27:e103da412e2b
--- a/CAN_asser.cpp Tue Jun 04 08:49:01 2019 +0000
+++ b/CAN_asser.cpp Tue Jun 04 17:25:49 2019 +0000
@@ -21,11 +21,11 @@
sauter_lignes(25);
wait_ms(1500);*/
-/*void sauter_lignes(int nb_lignes)
+void sauter_lignes(int nb_lignes)
{
for(unsigned i=0; i<nb_lignes; ++i)
dbug.printf("\n\r");
-}*/
+}
void can_init(void)
{
@@ -45,28 +45,24 @@
}
}
-void majFlagDpl(bool& flagFinDpl)
+void updateCAN(bool& flagFinDpl, short* pos)
{
while(nb_msg_can>0)
{
if(msg_can[pt_lecture_can].id == 0x111)
flagFinDpl = true;
-
+ else if(msg_can[pt_lecture_can].id == ODOMETRIE_POSITION)
+ get_pos(msg_can[pt_lecture_can], pos);
+
nb_msg_can--;
pt_lecture_can++;
}
-}
-
-void majPos(short* pos)
-{
- while(nb_msg_can>0)
- {
- if(msg_can[pt_lecture_can].id == ODOMETRIE_POSITION)
- get_pos(msg_can[pt_lecture_can], pos);
-
- nb_msg_can--;
- pt_lecture_can++;
- }
+
+ /* Test permettant de garder un angle compris entre -180 degrés et 180 degrés */
+ if(pos[2] <= -1800)
+ pos[2] = 3600 + pos[2];
+ else if(pos[2] >= 1800)
+ pos[2] = pos[2] - 3600;
}
void get_pos(CANMessage msg_pos, short* position)