Version fonctionnelle : Gouvernail OK

Tento commit je obsažen v:
Paul Faure 2020-11-13 20:12:57 +01:00
rodič 1feb054b2b
revize dca1dd52cf
4 změnil soubory, kde provedl 47 přidání a 136 odebrání

Zobrazit soubor

@ -130,7 +130,7 @@
<SetRegEntry> <SetRegEntry>
<Number>0</Number> <Number>0</Number>
<Key>DLGTARM</Key> <Key>DLGTARM</Key>
<Name>(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=621,97,1215,791,0)(131=157,121,751,815,0)(132=147,87,741,781,0)(133=-1,-1,-1,-1,0)(160=-1,-1,-1,-1,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)(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)</Name> <Name>(1010=668,263,1044,820,0)(1007=-1,-1,-1,-1,0)(1008=179,560,555,796,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=1037,48,1458,453,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=621,97,1215,791,0)(131=157,121,751,815,0)(132=147,87,741,781,0)(133=524,166,1118,860,0)(160=-1,-1,-1,-1,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)(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)</Name>
</SetRegEntry> </SetRegEntry>
<SetRegEntry> <SetRegEntry>
<Number>0</Number> <Number>0</Number>
@ -157,71 +157,7 @@
<Bp> <Bp>
<Number>0</Number> <Number>0</Number>
<Type>0</Type> <Type>0</Type>
<LineNumber>35</LineNumber> <LineNumber>78</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134219770</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>..\Src\Gouvernail.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\NUCLEO_F103RB\../Src/Gouvernail.c\35</Expression>
</Bp>
<Bp>
<Number>1</Number>
<Type>0</Type>
<LineNumber>66</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134219278</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>..\Src\Voilier.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\NUCLEO_F103RB\../Src/Voilier.c\66</Expression>
</Bp>
<Bp>
<Number>2</Number>
<Type>0</Type>
<LineNumber>67</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134219284</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>..\Src\Voilier.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\NUCLEO_F103RB\../Src/Voilier.c\67</Expression>
</Bp>
<Bp>
<Number>3</Number>
<Type>0</Type>
<LineNumber>68</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134219292</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>..\Src\Voilier.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\NUCLEO_F103RB\../Src/Voilier.c\68</Expression>
</Bp>
<Bp>
<Number>4</Number>
<Type>0</Type>
<LineNumber>56</LineNumber>
<EnabledFlag>1</EnabledFlag> <EnabledFlag>1</EnabledFlag>
<Address>0</Address> <Address>0</Address>
<ByteObject>0</ByteObject> <ByteObject>0</ByteObject>
@ -239,7 +175,22 @@
<Ww> <Ww>
<count>0</count> <count>0</count>
<WinNumber>1</WinNumber> <WinNumber>1</WinNumber>
<ItemText>allure</ItemText> <ItemText>commandouille,0x0A</ItemText>
</Ww>
<Ww>
<count>1</count>
<WinNumber>1</WinNumber>
<ItemText>lecture,0x0A</ItemText>
</Ww>
<Ww>
<count>2</count>
<WinNumber>1</WinNumber>
<ItemText>lecture1</ItemText>
</Ww>
<Ww>
<count>3</count>
<WinNumber>1</WinNumber>
<ItemText>lecture2</ItemText>
</Ww> </Ww>
</WatchWindow1> </WatchWindow1>
<Tracepoint> <Tracepoint>
@ -250,7 +201,7 @@
<periodic>1</periodic> <periodic>1</periodic>
<aLwin>1</aLwin> <aLwin>1</aLwin>
<aCover>0</aCover> <aCover>0</aCover>
<aSer1>0</aSer1> <aSer1>1</aSer1>
<aSer2>0</aSer2> <aSer2>0</aSer2>
<aPa>0</aPa> <aPa>0</aPa>
<viewmode>1</viewmode> <viewmode>1</viewmode>
@ -393,7 +344,7 @@
<SetRegEntry> <SetRegEntry>
<Number>0</Number> <Number>0</Number>
<Key>DLGDARM</Key> <Key>DLGDARM</Key>
<Name>(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,34,1303,785,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)</Name> <Name>(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,34,1303,785,0)(133=-1,-1,-1,-1,0)(160=79,295,527,709,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)</Name>
</SetRegEntry> </SetRegEntry>
<SetRegEntry> <SetRegEntry>
<Number>0</Number> <Number>0</Number>
@ -432,7 +383,7 @@
<Type>0</Type> <Type>0</Type>
<LineNumber>99</LineNumber> <LineNumber>99</LineNumber>
<EnabledFlag>1</EnabledFlag> <EnabledFlag>1</EnabledFlag>
<Address>134218684</Address> <Address>134221672</Address>
<ByteObject>0</ByteObject> <ByteObject>0</ByteObject>
<HtxType>0</HtxType> <HtxType>0</HtxType>
<ManyObjects>0</ManyObjects> <ManyObjects>0</ManyObjects>
@ -443,54 +394,6 @@
<ExecCommand></ExecCommand> <ExecCommand></ExecCommand>
<Expression>\\NUCLEO_F103RB\../MyDrivers/MyTimer.c\99</Expression> <Expression>\\NUCLEO_F103RB\../MyDrivers/MyTimer.c\99</Expression>
</Bp> </Bp>
<Bp>
<Number>1</Number>
<Type>0</Type>
<LineNumber>12</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134218790</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>..\Src\Voilier.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\NUCLEO_F103RB\../Src/Voilier.c\12</Expression>
</Bp>
<Bp>
<Number>2</Number>
<Type>0</Type>
<LineNumber>49</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134218416</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>..\Src\Allure.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\NUCLEO_F103RB\../Src/Allure.c\49</Expression>
</Bp>
<Bp>
<Number>3</Number>
<Type>0</Type>
<LineNumber>17</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134218794</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>..\Src\Voilier.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\NUCLEO_F103RB\../Src/Voilier.c\17</Expression>
</Bp>
</Breakpoint> </Breakpoint>
<WatchWindow1> <WatchWindow1>
<Ww> <Ww>
@ -512,7 +415,7 @@
<periodic>1</periodic> <periodic>1</periodic>
<aLwin>1</aLwin> <aLwin>1</aLwin>
<aCover>0</aCover> <aCover>0</aCover>
<aSer1>0</aSer1> <aSer1>1</aSer1>
<aSer2>0</aSer2> <aSer2>0</aSer2>
<aPa>0</aPa> <aPa>0</aPa>
<viewmode>1</viewmode> <viewmode>1</viewmode>

Zobrazit soubor

@ -4,6 +4,7 @@
#include "maths.h" #include "maths.h"
#define MAX_PWM (19999) #define MAX_PWM (19999)
#define MAX_PWM_OUTPUT (34999)
/** /**
* @brief Configure le récepteur de la télécommande ainsi que le plateau rotatif. * @brief Configure le récepteur de la télécommande ainsi que le plateau rotatif.
@ -20,14 +21,12 @@ void ConfGouvernail(void) {
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOA); LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOA);
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOB); LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOB);
// Configuration des IO -> pin B6 et 7 en alternate input, pin A1 en alternate output, et, pin A2 en output push pull // Configuration des IO -> pin B6 en alternate input, pin A1 en alternate output, et, pin A2 en output push pull
LL_GPIO_SetPinMode(GPIOB, LL_GPIO_PIN_6, LL_GPIO_MODE_FLOATING); LL_GPIO_SetPinMode(GPIOB, LL_GPIO_PIN_6, LL_GPIO_MODE_FLOATING);
LL_GPIO_SetPinMode(GPIOB, LL_GPIO_PIN_7, LL_GPIO_MODE_FLOATING);
LL_GPIO_SetPinMode(GPIOA, LL_GPIO_PIN_1, LL_GPIO_MODE_ALTERNATE); LL_GPIO_SetPinMode(GPIOA, LL_GPIO_PIN_1, LL_GPIO_MODE_ALTERNATE);
LL_GPIO_SetPinOutputType(GPIOA, LL_GPIO_PIN_1, LL_GPIO_OUTPUT_PUSHPULL); LL_GPIO_SetPinOutputType(GPIOA, LL_GPIO_PIN_1, LL_GPIO_OUTPUT_PUSHPULL);
LL_GPIO_SetPinMode(GPIOA, LL_GPIO_PIN_2, LL_GPIO_MODE_OUTPUT_2MHz); LL_GPIO_SetPinMode(GPIOA, LL_GPIO_PIN_2, LL_GPIO_MODE_OUTPUT_2MHz);
LL_GPIO_SetPinOutputType(GPIOA, LL_GPIO_PIN_2, LL_GPIO_OUTPUT_PUSHPULL); LL_GPIO_SetPinOutputType(GPIOA, LL_GPIO_PIN_2, LL_GPIO_OUTPUT_PUSHPULL);
LL_GPIO_SetOutputPin(GPIOA, LL_GPIO_PIN_2);
//Configuration des timers //Configuration des timers
@ -45,6 +44,22 @@ void ConfGouvernail(void) {
LL_TIM_OC_SetCompareCH2(TIM2, 0); LL_TIM_OC_SetCompareCH2(TIM2, 0);
LL_TIM_EnableCounter(TIM2); LL_TIM_EnableCounter(TIM2);
LL_TIM_CC_EnableChannel(TIM2, LL_TIM_CHANNEL_CH2); LL_TIM_CC_EnableChannel(TIM2, LL_TIM_CHANNEL_CH2);
LL_TIM_IC_InitTypeDef Tim4Initializer;
LL_TIM_IC_StructInit(&Tim4Initializer);
Tim4Initializer.ICActiveInput = LL_TIM_ACTIVEINPUT_DIRECTTI;
Tim4Initializer.ICPolarity = LL_TIM_IC_POLARITY_RISING;
LL_TIM_IC_Init(TIM4, LL_TIM_CHANNEL_CH1, &Tim4Initializer);
Tim4Initializer.ICActiveInput = LL_TIM_ACTIVEINPUT_INDIRECTTI;
Tim4Initializer.ICPolarity = LL_TIM_IC_POLARITY_FALLING;
LL_TIM_IC_Init(TIM4, LL_TIM_CHANNEL_CH2, &Tim4Initializer);
LL_TIM_SetAutoReload(TIM4, MAX_PWM_OUTPUT);
LL_TIM_SetPrescaler(TIM4, 71);
LL_TIM_SetSlaveMode(TIM4, LL_TIM_SLAVEMODE_RESET);
LL_TIM_SetTriggerInput(TIM4, LL_TIM_TS_TI1FP1);
LL_TIM_EnableCounter(TIM4);
LL_TIM_CC_EnableChannel(TIM4, LL_TIM_CHANNEL_CH1);
LL_TIM_CC_EnableChannel(TIM4, LL_TIM_CHANNEL_CH2);
} }
/** /**
@ -54,7 +69,8 @@ void ConfGouvernail(void) {
* @retval La commande de la télécommande, représenté en % bidirectionnel -> int entre -100 et 100 (sens codé par le signe, vitesse par la valeur absolue) * @retval La commande de la télécommande, représenté en % bidirectionnel -> int entre -100 et 100 (sens codé par le signe, vitesse par la valeur absolue)
*/ */
int LireTelecommande(void) { int LireTelecommande(void) {
return 0; int lecture = LL_TIM_IC_GetCaptureCH2(TIM4) + 1;
return ((lecture - 1500) / 5);
} }
/** /**

Zobrazit soubor

@ -3,7 +3,7 @@
/** /**
* @brief Configure le récepteur de la télécommande ainsi que le plateau rotatif. * @brief Configure le récepteur de la télécommande ainsi que le plateau rotatif.
* @note Configuration du port PB6 et 7 en alternate input pour récupérer les signaux * @note Configuration du port PB6 et 7 en alternate input pour récupérer les signaux de la télécommande
Configuration des deux channels du TIM4 pour la lecture de la PWM Configuration des deux channels du TIM4 pour la lecture de la PWM
Configuration du PA1 en alternate output (commande PWM vitesse) et PA2 en output push pull pour commander le sens Configuration du PA1 en alternate output (commande PWM vitesse) et PA2 en output push pull pour commander le sens
Configuration du TIM2_CH2 pour la sortie PWM Configuration du TIM2_CH2 pour la sortie PWM

Zobrazit soubor

@ -10,8 +10,6 @@
#include "stm32f1xx_ll_utils.h" // utile dans la fonction SystemClock_Config #include "stm32f1xx_ll_utils.h" // utile dans la fonction SystemClock_Config
#include "stm32f1xx_ll_system.h" // utile dans la fonction SystemClock_Config #include "stm32f1xx_ll_system.h" // utile dans la fonction SystemClock_Config
void SystemClock_Config(void); void SystemClock_Config(void);
/** /**
@ -59,15 +57,9 @@ void Background(){
TendreVoile(CalculerTension(RecupAllure())); //on tend la voile grâce à la tension obtenue TendreVoile(CalculerTension(RecupAllure())); //on tend la voile grâce à la tension obtenue
//Gouvernail //Gouvernail
//int commande = LireTelecommande(); //on lit la valeur renvoyée par la télécommande int commande = LireTelecommande(); //on lit la valeur renvoyée par la télécommande
CommanderMoteur(0); //On commande le moteur pour aller à la vitesse voulue CommanderMoteur(commande); //On commande le moteur pour aller à la vitesse voulue
CommanderMoteur(-0);
CommanderMoteur(-1);
CommanderMoteur(1);
CommanderMoteur(-50);
CommanderMoteur(50);
CommanderMoteur(-100);
CommanderMoteur(100);
//Anti-Chavirement //Anti-Chavirement
/*int rouli = RecupRouli(); /*int rouli = RecupRouli();
int danger = CalculerDanger(rouli);//renvoi boolean : int à 0 si faux et 1 si vrai int danger = CalculerDanger(rouli);//renvoi boolean : int à 0 si faux et 1 si vrai
@ -138,7 +130,7 @@ void SystemClock_Config(void)
LL_RCC_SetAPB2Prescaler(LL_RCC_APB2_DIV_1); LL_RCC_SetAPB2Prescaler(LL_RCC_APB2_DIV_1);
/* Set systick to 1ms in using frequency set to 72MHz */ /* Set systick to 1ms in using frequency set to 72MHz */
//LL_Init1msTick(72000000); !! décommenter que si l'IT est récupérée LL_Init1msTick(72000000); //!! décommenter que si l'IT est récupérée
/* Update CMSIS variable (which can be updated also through SystemCoreClockUpdate function) */ /* Update CMSIS variable (which can be updated also through SystemCoreClockUpdate function) */
LL_SetSystemCoreClock(72000000); LL_SetSystemCoreClock(72000000);