diff --git a/MDK-ARM/Project.uvoptx b/MDK-ARM/Project.uvoptx
index 3976fe0..578f2ae 100644
--- a/MDK-ARM/Project.uvoptx
+++ b/MDK-ARM/Project.uvoptx
@@ -103,7 +103,7 @@
1
0
0
- 6
+ 0
@@ -114,7 +114,7 @@
- STLink\ST-LINKIII-KEIL_SWO.dll
+ BIN\UL2CM3.DLL
@@ -130,7 +130,7 @@
0
DLGTARM
- (1010=668,263,1044,820,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(1011=-1,-1,-1,-1,0)(180=-1,-1,-1,-1,0)(120=1027,281,1448,686,0)(121=-1,-1,-1,-1,0)(122=348,235,769,640,0)(123=-1,-1,-1,-1,0)(140=-1,-1,-1,-1,0)(240=87,183,486,528,0)(190=-1,-1,-1,-1,0)(200=-1,-1,-1,-1,0)(170=-1,-1,-1,-1,0)(130=-1,-1,-1,-1,0)(131=-1,-1,-1,-1,0)(132=784,58,1378,752,0)(133=-1,-1,-1,-1,0)(160=900,145,1348,559,0)(161=476,349,924,763,0)(162=-1,-1,-1,-1,0)(210=-1,-1,-1,-1,0)(211=-1,-1,-1,-1,0)(220=-1,-1,-1,-1,0)(221=-1,-1,-1,-1,0)(230=-1,-1,-1,-1,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=764,77,1367,711,0)(151=-1,-1,-1,-1,0)
+ (1010=1544,437,1920,994,1)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(1011=-1,-1,-1,-1,0)(180=-1,-1,-1,-1,0)(120=1027,281,1448,686,0)(121=-1,-1,-1,-1,0)(122=348,235,769,640,0)(123=-1,-1,-1,-1,0)(140=-1,-1,-1,-1,0)(240=87,183,486,528,0)(190=-1,-1,-1,-1,0)(200=-1,-1,-1,-1,0)(170=-1,-1,-1,-1,0)(130=1029,93,1623,787,0)(131=-1,-1,-1,-1,0)(132=1285,441,1879,1135,1)(133=-1,-1,-1,-1,0)(160=900,145,1348,559,0)(161=476,349,924,763,0)(162=-1,-1,-1,-1,0)(210=-1,-1,-1,-1,0)(211=-1,-1,-1,-1,0)(220=-1,-1,-1,-1,0)(221=-1,-1,-1,-1,0)(230=-1,-1,-1,-1,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=1317,406,1920,1040,1)(151=-1,-1,-1,-1,0)
0
@@ -145,7 +145,7 @@
0
UL2CM3
- UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128 -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM))
+ -UAny -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM)
0
@@ -153,40 +153,7 @@
-U-O142 -O2254 -SF10000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP (ARM Core") -D00(1BA01477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC800 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM)
-
-
- 0
- 0
- 96
- 1
- 134223920
- 0
- 0
- 0
- 0
- 0
- 1
- ..\Src\Voilier.c
-
- \\NUCLEO_F103RB\../Src/Voilier.c\96
-
-
- 1
- 0
- 56
- 1
- 134223654
- 0
- 0
- 0
- 0
- 0
- 1
- ..\Src\Voilier.c
-
- \\NUCLEO_F103RB\../Src/Voilier.c\56
-
-
+
0
@@ -198,6 +165,21 @@
1
NiveauBatterie
+
+ 2
+ 1
+ res
+
+
+ 3
+ 1
+ angle_voile
+
+
+ 4
+ 1
+ retourCapteur,0x0A
+
0
@@ -208,7 +190,7 @@
1
0
1
- 1
+ 0
0
1
0
@@ -350,7 +332,7 @@
0
DLGDARM
- (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(1011=-1,-1,-1,-1,0)(180=120,153,415,450,0)(120=204,207,625,634,0)(121=-1,-1,-1,-1,0)(122=896,89,1317,516,0)(123=-1,-1,-1,-1,0)(140=-1,-1,-1,-1,0)(240=-1,-1,-1,-1,0)(190=-1,-1,-1,-1,0)(200=-1,-1,-1,-1,0)(170=-1,-1,-1,-1,0)(130=248,17,842,768,0)(131=521,17,1115,768,0)(132=709,17,1303,768,0)(133=-1,-1,-1,-1,0)(160=251,288,699,702,0)(161=-1,-1,-1,-1,0)(162=-1,-1,-1,-1,0)(210=-1,-1,-1,-1,0)(211=-1,-1,-1,-1,0)(220=-1,-1,-1,-1,0)(221=-1,-1,-1,-1,0)(230=-1,-1,-1,-1,0)(234=-1,-1,-1,-1,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=-1,-1,-1,-1,0)(151=-1,-1,-1,-1,0)
+ (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(1011=-1,-1,-1,-1,0)(180=120,153,415,450,0)(120=204,207,625,634,0)(121=-1,-1,-1,-1,0)(122=896,89,1317,516,0)(123=-1,-1,-1,-1,0)(140=-1,-1,-1,-1,0)(240=-1,-1,-1,-1,0)(190=-1,-1,-1,-1,0)(200=-1,-1,-1,-1,0)(170=-1,-1,-1,-1,0)(130=248,17,842,768,0)(131=521,17,1115,768,0)(132=896,77,1490,828,1)(133=-1,-1,-1,-1,0)(160=1068,325,1516,739,1)(161=-1,-1,-1,-1,0)(162=-1,-1,-1,-1,0)(210=-1,-1,-1,-1,0)(211=-1,-1,-1,-1,0)(220=-1,-1,-1,-1,0)(221=-1,-1,-1,-1,0)(230=-1,-1,-1,-1,0)(234=-1,-1,-1,-1,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=-1,-1,-1,-1,0)(151=-1,-1,-1,-1,0)
0
@@ -383,104 +365,7 @@
-U-O142 -O2254 -S0 -C0 -A0 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC800 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM)
-
-
- 0
- 0
- 31
- 1
- 134223390
- 0
- 0
- 0
- 0
- 0
- 1
- ..\Src\Voilier.c
-
- \\NUCLEO_F103RB\../Src/Voilier.c\31
-
-
- 1
- 0
- 32
- 1
- 134223394
- 0
- 0
- 0
- 0
- 0
- 1
- ..\Src\Voilier.c
-
- \\NUCLEO_F103RB\../Src/Voilier.c\32
-
-
- 2
- 0
- 77
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\Src\Voilier.c
-
-
-
-
- 3
- 0
- 35
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\Src\Voilier.c
-
-
-
-
- 4
- 0
- 36
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\Src\Voilier.c
-
-
-
-
- 5
- 0
- 81
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\Src\Voilier.c
-
-
-
-
+
0
@@ -502,7 +387,7 @@
1
0
1
- 1
+ 0
0
1
0
@@ -630,7 +515,7 @@
2
6
1
- 1
+ 0
0
0
..\Src\Voile.c
diff --git a/MDK-ARM/Project.uvprojx b/MDK-ARM/Project.uvprojx
index 0c3c172..24db59b 100644
--- a/MDK-ARM/Project.uvprojx
+++ b/MDK-ARM/Project.uvprojx
@@ -10,508 +10,7 @@
NUCLEO-F103RB
0x4
ARM-ADS
- 5060750::V5.06 update 6 (build 750)::ARMCC
- 8
-
-
- STM32F103RB
- STMicroelectronics
- Keil.STM32F1xx_DFP.2.3.0
- http://www.keil.com/pack/
- IRAM(0x20000000-0x20004FFF) IROM(0x8000000-0x801FFFF) CLOCK(8000000) CPUTYPE("Cortex-M3")
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $$Device:STM32F103RB$SVD\STM32F103xx.svd
- 0
- 0
-
-
-
-
-
-
- 0
- 0
- 0
- 0
- 1
-
- NUCLEO-F103RB\
- NUCLEO-F103RB
- 1
- 0
- 0
- 1
- 1
-
- 1
- 0
- 0
-
- 0
- 0
-
-
- 0
- 0
- 0
- 0
-
-
- 0
- 0
-
-
- 0
- 0
- 0
- 0
-
-
- 0
- 0
-
-
- 0
- 0
- 0
- 0
-
- 0
-
-
-
- 0
- 0
- 0
- 0
- 0
- 1
- 0
- 0
- 0
- 0
- 3
-
-
- 0
-
-
- SARMCM3.DLL
-
- DARMSTM.DLL
- -pSTM32F103RB
- SARMCM3.DLL
-
- TARMSTM.DLL
- -pSTM32F103RB
-
-
-
- 1
- 0
- 0
- 0
- 16
-
-
-
-
- 1
- 0
- 0
- 1
- 1
- 4107
-
- 1
- STLink\ST-LINKIII-KEIL_SWO.dll
-
-
-
-
-
- 0
-
-
-
- 0
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 0
- 1
- 1
- 0
- 1
- 1
- 0
- 0
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 0
- 0
- "Cortex-M3"
-
- 0
- 0
- 0
- 1
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 8
- 1
- 0
- 0
- 0
- 3
- 3
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 1
- 0
- 0
- 0
- 0
- 1
- 0
-
-
- 0
- 0x0
- 0x0
-
-
- 0
- 0x0
- 0x0
-
-
- 0
- 0x0
- 0x0
-
-
- 0
- 0x0
- 0x0
-
-
- 0
- 0x0
- 0x0
-
-
- 0
- 0x0
- 0x0
-
-
- 0
- 0x20000000
- 0x5000
-
-
- 1
- 0x8000000
- 0x20000
-
-
- 0
- 0x0
- 0x0
-
-
- 1
- 0x0
- 0x0
-
-
- 1
- 0x0
- 0x0
-
-
- 1
- 0x0
- 0x0
-
-
- 1
- 0x8000000
- 0x20000
-
-
- 1
- 0x0
- 0x0
-
-
- 0
- 0x0
- 0x0
-
-
- 0
- 0x0
- 0x0
-
-
- 0
- 0x0
- 0x0
-
-
- 0
- 0x20000000
- 0x5000
-
-
- 0
- 0x0
- 0x0
-
-
-
-
-
- 1
- 4
- 0
- 0
- 1
- 0
- 0
- 0
- 0
- 0
- 2
- 0
- 0
- 0
- 0
- 0
- 1
- 1
- 1
- 1
- 0
- 0
- 0
-
- --C99
- STM32F103xB,USE_FULL_LL_DRIVER,HSE_VALUE=8000000U
-
- ..\Inc;..\LLDrivers\inc;..\Services;..\MyDrivers
-
-
-
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
-
-
-
-
-
-
-
-
- 1
- 0
- 0
- 0
- 1
- 0
- 0x08000000
- 0x20000000
-
-
-
-
-
-
-
-
-
-
-
-
- User Services
-
-
- Voilier.c
- 1
- ..\Src\Voilier.c
-
-
-
-
- MyDrivers
-
-
- Allure.c
- 1
- ..\Src\Allure.c
-
-
- Gouvernail.c
- 1
- ..\Src\Gouvernail.c
-
-
- Heure.c
- 1
- ..\Src\Heure.c
-
-
- Transmission.c
- 1
- ..\Src\Transmission.c
-
-
- Voile.c
- 1
- ..\Src\Voile.c
-
-
- Allure.h
- 5
- ..\Src\Allure.h
-
-
- maths.h
- 5
- ..\Src\maths.h
-
-
- maths.c
- 1
- ..\Src\maths.c
-
-
- Securite.c
- 1
- ..\..\Projet_Voilier_4IR\Src\Securite.c
-
-
- string.c
- 1
- ..\..\Projet_Voilier_4IR\Src\string.c
-
-
-
-
- Drivers/STM32f1xx_LL_Driver
-
-
- stm32f1xx_ll_rcc.c
- 1
- ..\LLDrivers\src\stm32f1xx_ll_rcc.c
-
-
- stm32f1xx_ll_utils.c
- 1
- ..\LLDrivers\src\stm32f1xx_ll_utils.c
-
-
- stm32f1xx_ll_gpio.c
- 1
- ..\LLDrivers\src\stm32f1xx_ll_gpio.c
-
-
- stm32f1xx_ll_tim.c
- 1
- ..\LLDrivers\src\stm32f1xx_ll_tim.c
-
-
- stm32f1xx_ll_exti.c
- 1
- ..\LLDrivers\src\stm32f1xx_ll_exti.c
-
-
- stm32f1xx_ll_usart.c
- 1
- ..\LLDrivers\src\stm32f1xx_ll_usart.c
-
-
-
-
- Doc
-
-
- Drivers/CMSIS
-
-
- system_stm32f1xx.c
- 1
- ../Src/system_stm32f1xx.c
-
-
-
-
- Example/MDK-ARM
-
-
- startup_stm32f103xb.s
- 2
- startup_stm32f103xb.s
-
-
-
-
- ::CMSIS
-
-
-
-
- Simulateur
- 0x4
- ARM-ADS
- 5060750::V5.06 update 6 (build 750)::ARMCC
+ 5060750::V5.06 update 6 (build 750)::.\ARMCC
0
@@ -686,6 +185,7 @@
0
0
0
+ 0
0
0
8
@@ -852,7 +352,509 @@
0
0
0
- 0
+ 4
+
+
+
+
+
+
+
+
+ 1
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0x08000000
+ 0x20000000
+
+
+
+
+
+
+
+
+
+
+
+
+ User Services
+
+
+ Voilier.c
+ 1
+ ..\Src\Voilier.c
+
+
+
+
+ MyDrivers
+
+
+ Allure.c
+ 1
+ ..\Src\Allure.c
+
+
+ Gouvernail.c
+ 1
+ ..\Src\Gouvernail.c
+
+
+ Heure.c
+ 1
+ ..\Src\Heure.c
+
+
+ Transmission.c
+ 1
+ ..\Src\Transmission.c
+
+
+ Voile.c
+ 1
+ ..\Src\Voile.c
+
+
+ Allure.h
+ 5
+ ..\Src\Allure.h
+
+
+ maths.h
+ 5
+ ..\Src\maths.h
+
+
+ maths.c
+ 1
+ ..\Src\maths.c
+
+
+ Securite.c
+ 1
+ ..\..\Projet_Voilier_4IR\Src\Securite.c
+
+
+ string.c
+ 1
+ ..\..\Projet_Voilier_4IR\Src\string.c
+
+
+
+
+ Drivers/STM32f1xx_LL_Driver
+
+
+ stm32f1xx_ll_rcc.c
+ 1
+ ..\LLDrivers\src\stm32f1xx_ll_rcc.c
+
+
+ stm32f1xx_ll_utils.c
+ 1
+ ..\LLDrivers\src\stm32f1xx_ll_utils.c
+
+
+ stm32f1xx_ll_gpio.c
+ 1
+ ..\LLDrivers\src\stm32f1xx_ll_gpio.c
+
+
+ stm32f1xx_ll_tim.c
+ 1
+ ..\LLDrivers\src\stm32f1xx_ll_tim.c
+
+
+ stm32f1xx_ll_exti.c
+ 1
+ ..\LLDrivers\src\stm32f1xx_ll_exti.c
+
+
+ stm32f1xx_ll_usart.c
+ 1
+ ..\LLDrivers\src\stm32f1xx_ll_usart.c
+
+
+
+
+ Doc
+
+
+ Drivers/CMSIS
+
+
+ system_stm32f1xx.c
+ 1
+ ../Src/system_stm32f1xx.c
+
+
+
+
+ Example/MDK-ARM
+
+
+ startup_stm32f103xb.s
+ 2
+ startup_stm32f103xb.s
+
+
+
+
+ ::CMSIS
+
+
+
+
+ Simulateur
+ 0x4
+ ARM-ADS
+ 5060750::V5.06 update 6 (build 750)::.\ARMCC
+ 0
+
+
+ STM32F103RB
+ STMicroelectronics
+ Keil.STM32F1xx_DFP.2.3.0
+ http://www.keil.com/pack/
+ IRAM(0x20000000-0x20004FFF) IROM(0x8000000-0x801FFFF) CLOCK(8000000) CPUTYPE("Cortex-M3")
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $$Device:STM32F103RB$SVD\STM32F103xx.svd
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 0
+ 0
+ 0
+ 1
+
+ NUCLEO-F103RB\
+ NUCLEO-F103RB
+ 1
+ 0
+ 0
+ 1
+ 1
+
+ 1
+ 0
+ 0
+
+ 0
+ 0
+
+
+ 0
+ 0
+ 0
+ 0
+
+
+ 0
+ 0
+
+
+ 0
+ 0
+ 0
+ 0
+
+
+ 0
+ 0
+
+
+ 0
+ 0
+ 0
+ 0
+
+ 0
+
+
+
+ 0
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 3
+
+
+ 0
+
+
+ SARMCM3.DLL
+
+ DARMSTM.DLL
+ -pSTM32F103RB
+ SARMCM3.DLL
+
+ TARMSTM.DLL
+ -pSTM32F103RB
+
+
+
+ 1
+ 0
+ 0
+ 0
+ 16
+
+
+
+
+ 1
+ 0
+ 0
+ 1
+ 1
+ 4107
+
+ 1
+ STLink\ST-LINKIII-KEIL_SWO.dll
+
+
+
+
+
+ 0
+
+
+
+ 0
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 1
+ 1
+ 0
+ 1
+ 1
+ 0
+ 0
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ "Cortex-M3"
+
+ 0
+ 0
+ 0
+ 1
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 8
+ 1
+ 0
+ 0
+ 0
+ 3
+ 3
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 1
+ 0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x20000000
+ 0x5000
+
+
+ 1
+ 0x8000000
+ 0x20000
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 1
+ 0x0
+ 0x0
+
+
+ 1
+ 0x0
+ 0x0
+
+
+ 1
+ 0x0
+ 0x0
+
+
+ 1
+ 0x8000000
+ 0x20000
+
+
+ 1
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x0
+ 0x0
+
+
+ 0
+ 0x20000000
+ 0x5000
+
+
+ 0
+ 0x0
+ 0x0
+
+
+
+
+
+ 1
+ 4
+ 0
+ 0
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 2
+ 0
+ 0
+ 0
+ 0
+ 0
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ 0
+
+ --C99
+ STM32F103xB,USE_FULL_LL_DRIVER,HSE_VALUE=8000000U
+
+ ..\Inc;..\LLDrivers\inc;..\Services;..\MyDrivers
+
+
+
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 4
@@ -1024,4 +1026,19 @@
+
+
+
+ <Project Info>
+
+
+
+
+
+ 0
+ 1
+
+
+
+
diff --git a/Src/Allure.c b/Src/Allure.c
index f63304c..a40f69f 100644
--- a/Src/Allure.c
+++ b/Src/Allure.c
@@ -53,19 +53,19 @@ void ConfAllure(void) {
Tim3Initializer.IC2Polarity = LL_TIM_IC_POLARITY_RISING;
Tim3Initializer.IC2Prescaler = LL_TIM_ICPSC_DIV1;
LL_TIM_ENCODER_Init(TIM3, &Tim3Initializer);
- LL_TIM_SetAutoReload(TIM3, 359);
+ LL_TIM_SetAutoReload(TIM3, 719);
LL_TIM_EnableCounter(TIM3);
}
-
+int retourCapteur;
int RecupAllure(void) {
if (!initialized) {
return 180; //Si jamais la girouette n'est pas initialisée, on relache les voiles (comme en cas d'alerte dee chavirement)
} else {
- int retourCapteur = (int)LL_TIM_GetCounter(TIM3);
- if (retourCapteur < 180) {
- return retourCapteur;
+ retourCapteur = (int)LL_TIM_GetCounter(TIM3);
+ if (retourCapteur < 360) {
+ return (retourCapteur/2);
} else {
- return retourCapteur - 360;
+ return (retourCapteur + 720)/2;
}
}
}
@@ -75,7 +75,7 @@ char * AllureToString(int alpha) {
if (alpha_abs < 45) {
return "Vent debout";
} else if (alpha < 55) {
- return "Près";
+ return "Pres";
} else if (alpha < 65) {
return "Bon plein";
} else if (alpha < 80) {
@@ -87,7 +87,7 @@ char * AllureToString(int alpha) {
} else if (alpha < 155) {
return "Grand largue";
} else if (alpha < 180) {
- return "Vent arrière";
+ return "Vent arriere";
} else {
return "ERROR";
}
diff --git a/Src/Gouvernail.c b/Src/Gouvernail.c
index bf704e3..d63564c 100644
--- a/Src/Gouvernail.c
+++ b/Src/Gouvernail.c
@@ -3,7 +3,7 @@
#include "stm32f1xx_ll_tim.h" // TIMER
#include "maths.h"
-#define MAX_PWM (19999)
+#define MAX_PWM (50)
#define MAX_PWM_OUTPUT (34999)
/**
@@ -70,7 +70,12 @@ void ConfGouvernail(void) {
*/
int LireTelecommande(void) {
int lecture = LL_TIM_IC_GetCaptureCH2(TIM4) + 1;
- return ((lecture - 1500) / 5);
+ int Valeur_Lue = ((lecture - 1500) / 5);
+ if (abs(Valeur_Lue) < 10) {
+ return 0;
+ } else {
+ return Valeur_Lue;
+ }
}
/**
diff --git a/Src/Securite.c b/Src/Securite.c
index 6ee8a42..c0e8769 100644
--- a/Src/Securite.c
+++ b/Src/Securite.c
@@ -7,18 +7,14 @@
#include "stm32f1xx_ll_rcc.h" // utile dans la fonction SystemClock_Config
#include "Voile.h"
+#define SEUIL45DEGRESSENS1 (1853)
+
+#define SEUIL45DEGRESSENS2 (2457)
+
// Seuil represente la valeur (en %) en dessous de laquelle le niveau de batterie est consideree faible
#define Seuil (20)
-// Seuil represente la valeur de l'angle au dessus de laquelle le chavirement est trop prononcé
-#define SeuilAngle (40)
-
-
-int drapeauRecupSecurite = 0; // Flag qui est mis à 1 toute les 10 sec pour recuperer niveau batterie/rouli et envoi régulier
-int drapeauDangerBatterie = 0; //Flag qui est mis à 1 toute les 10 sec si batterie faible --> envoie message alarme
-int drapeauDangerRouli = 0; //Flag qui est mis à 1 toute les 10 sec si rouli pas bon --> envoie message alarme
-
void ConfSecurite(){
//On est pas sûrs pour ADC 1, voir datasheet page 28
@@ -100,7 +96,7 @@ int CalculerDangerNiveauBatterie(int niveau){
int CalculerDangerChavirement(int gamma){
- if ( gamma >= SeuilAngle)
+ if ((gamma > SEUIL45DEGRESSENS2) || (gamma < SEUIL45DEGRESSENS1))
{
return 1;
}
@@ -117,6 +113,6 @@ int RecupRouli(){
while(!LL_ADC_IsActiveFlag_JEOS(ADC1)){}
// R?cuperation de la valeur apres conversion
int NiveauChavirement = LL_ADC_INJ_ReadConversionData12(ADC1,LL_ADC_INJ_RANK_1);
- return 0; // Trouver le calcul de l'angle
+ return NiveauChavirement;
}
diff --git a/Src/Voile.c b/Src/Voile.c
index 0e779fe..51b1991 100644
--- a/Src/Voile.c
+++ b/Src/Voile.c
@@ -3,6 +3,7 @@
#include "stm32f1xx_ll_tim.h"
#include "stm32f1xx_ll_bus.h"
#include "maths.h" //Remplacer par maths.h quand on va tout faire marcher.
+#include "string.h"
#define ARR (19999)
#define PSC (71)
@@ -10,22 +11,22 @@
#define channel (1)
#define A_ALPHA_TO_BETA (2.0/3.0) //Coefficient directeur de la partie linéaire de la fonction transformant l'allure en angle de voile
#define B_ALPHA_TO_BETA (-30.0) //Ordonnée a l'origine de cette même fonction
-#define GAMMA_90 (19900) //Valeur du registre commandant la largeur de la PWM pour les voiles lachées
-#define GAMMA_0 (100) //Valeur du registre commandant la largeur de la PWM pour les voiles bordées au maximum
+#define GAMMA_90 (2100) //Valeur du registre commandant la largeur de la PWM pour les voiles lachées
+#define GAMMA_0 (1000) //Valeur du registre commandant la largeur de la PWM pour les voiles bordées au maximum
#define A_BETA_TO_GAMMA ((GAMMA_90 - GAMMA_0)/90.0) //Coefficient directeur de la relation entre l'angle de voile et la PWM
#define B_BETA_TO_GAMMA (GAMMA_0) //Ordonnée a l'origine
//Valeurs de CCR1 pour la PWM output
-#define POSITION_00 1000
-#define POSITION_10 1100
-#define POSITION_20 1200
-#define POSITION_30 1300
-#define POSITION_40 1400
-#define POSITION_50 1500
-#define POSITION_60 1600
-#define POSITION_70 1700
-#define POSITION_80 1800
-#define POSITION_90 1900
+#define POSITION_00 2100
+#define POSITION_10 1880
+#define POSITION_20 1770
+#define POSITION_30 1660
+#define POSITION_40 1550
+#define POSITION_50 1440
+#define POSITION_60 1330
+#define POSITION_70 1220
+#define POSITION_80 1110
+#define POSITION_90 1000
int angleVoileActuel = 0; //angle de la voile. Mis à jour quans on la tend. de 0 à 45.
@@ -34,6 +35,7 @@ int angleVoileActuel = 0; //angle de la voile. Mis
void ConfVoile(void){
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOA); //Enable l'horloge du GPIOA
+ LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_TIM1);
LL_TIM_SetAutoReload(Timer, ARR); //On règle l'ARR
LL_TIM_SetPrescaler(Timer, PSC); //On règle le PSC
LL_GPIO_SetPinMode(GPIOA,LL_GPIO_PIN_8,LL_GPIO_MODE_ALTERNATE); //Pin en mode output alternate
@@ -45,6 +47,7 @@ void ConfVoile(void){
LL_TIM_EnableCounter(Timer); //On commence le comptage
}
+float res;
int RecupTensionVoile(void){
return angleVoileActuel;
@@ -53,17 +56,18 @@ int RecupTensionVoile(void){
int CalculerTension(int alpha){
if (abs(alpha) < 45){
+ res = 0;
return 0;
} else {
- float res = A_ALPHA_TO_BETA * (float)abs(alpha) + B_ALPHA_TO_BETA;
+ res = A_ALPHA_TO_BETA * (float)abs(alpha) + B_ALPHA_TO_BETA;
return (int)res;
}
}
-
+float angle_voile;
void TendreVoile(int theta)
{
- if (theta < 5){
+ /*if (theta < 5){
Timer->CCR1 = POSITION_00;
angleVoileActuel = 0;
}
@@ -102,12 +106,30 @@ void TendreVoile(int theta)
else{
Timer->CCR1 = POSITION_90;
angleVoileActuel = 90;
- }
+ }*/
-
- //Timer->CCR1 = (int)(A_BETA_TO_GAMMA * (float)theta + B_BETA_TO_GAMMA) ;
+ angleVoileActuel = (A_BETA_TO_GAMMA * (float)theta + B_BETA_TO_GAMMA) ;
+ Timer->CCR1 = (int)angleVoileActuel ;
}
char * TensionVoileToString(int theta) {
- return "";
+ if (theta < 10) {
+ return "Voiles bordees";
+ } else if (theta < 20) {
+ return "Voiles a 20 degres";
+ } else if (theta < 30) {
+ return "Voiles a 30 degres";
+ } else if (theta < 40) {
+ return "Voiles a 40 degres";
+ } else if (theta < 50) {
+ return "Voiles a 50 degres";
+ } else if (theta < 60) {
+ return "Voiles a 60 degres";
+ } else if (theta < 70) {
+ return "Voiles a 70 degres";
+ } else if (theta < 80) {
+ return "Voiles a 80 degres";
+ } else {
+ return "Voiles choquees";
+ }
}
diff --git a/Src/Voilier.c b/Src/Voilier.c
index e4e74bb..f96f52f 100644
--- a/Src/Voilier.c
+++ b/Src/Voilier.c
@@ -59,11 +59,11 @@ void Task100ms(){
int dangerRoulis = 0; //Variable qui permet de ne pas tendre les voiles si il y a trop de roulis
- //Anti-Chavirement
+ //Anti-Chavirement
if(CalculerDangerChavirement(RecupRouli())){//renvoi boolean : int à 0 si faux et 1 si vrai
dangerRoulis = 1; //Pour pas retendre directement les voiles juste après.
- TendreVoile(90); //si il y a danger on relache les voiles (relacher les voiles = les mettre � 90)
- EnvoiExceptionnel("Risque de chavirement, voiles choquées");//Et on prévient l'utilisateur
+ TendreVoile(0); //si il y a danger on relache les voiles (relacher les voiles = les mettre � 90)
+ EnvoiExceptionnel("Risque de chavirement, voiles choquees");//Et on prévient l'utilisateur
}
//Anti-Chavirement
diff --git a/Src/string.h b/Src/string.h
index dc8e5e8..8bfd9ed 100644
--- a/Src/string.h
+++ b/Src/string.h
@@ -5,4 +5,5 @@ int Concatenate(char * chaine1, char * chaine2, int sizechaine1, int sizechaine2
int size_of(char * chaine);
+
#endif