diff --git a/BertheVarioTacPlatformIO/src/BertheVarioTac.cpp b/BertheVarioTacPlatformIO/src/BertheVarioTac.cpp index aba60c0..ceda144 100644 --- a/BertheVarioTacPlatformIO/src/BertheVarioTac.cpp +++ b/BertheVarioTacPlatformIO/src/BertheVarioTac.cpp @@ -9,7 +9,7 @@ #include "BertheVarioTac.h" -char g_NumVersion[] = "20241010b" ; +char g_NumVersion[] = "20241012a" ; //////////////////////////////////////////////////////////////////////////////// /// \brief Affiche le nom et le firmware diff --git a/BertheVarioTacPlatformIO/src/BertheVarioTac.h b/BertheVarioTacPlatformIO/src/BertheVarioTac.h index f38f342..cf1acf3 100644 --- a/BertheVarioTacPlatformIO/src/BertheVarioTac.h +++ b/BertheVarioTacPlatformIO/src/BertheVarioTac.h @@ -4,7 +4,7 @@ /// \brief Include global du projet de vario tactile /// /// \date creation : 20/09/2024 -/// \date modification : 10/10/2024 +/// \date modification : 12/10/2024 /// @@ -56,6 +56,7 @@ #include "Screen/CText2Screen.h" #include "Screen/CScreen.h" #include "GlobalVar/CFileHistoVol.h" +#include "GlobalVar/CNbSatDelay.h" #include "GlobalVar/CConfigFile.h" #include "Calculateur/CSortArray.h" #include "Calculateur/CTerrainsConnu.h" diff --git a/BertheVarioTacPlatformIO/src/GlobalVar/CConfigFile.cpp b/BertheVarioTacPlatformIO/src/GlobalVar/CConfigFile.cpp index 4d440a3..949b88d 100644 --- a/BertheVarioTacPlatformIO/src/GlobalVar/CConfigFile.cpp +++ b/BertheVarioTacPlatformIO/src/GlobalVar/CConfigFile.cpp @@ -4,7 +4,7 @@ /// \brief /// /// \date creation : 08/03/2024 -/// \date modification : 02/10/2024 +/// \date modification : 12/10/2024 /// #include "../BertheVarioTac.h" @@ -54,6 +54,12 @@ pLine->m_pVar = (void*) & m_vitesse_igc_kmh ; pLine->m_Type = TYPE_VAR_INT ; m_LinesVect.push_back( pLine ) ; +pLine = new st_line ; +pLine->m_NomVar = "[sat_sec]" ; +pLine->m_pVar = (void*) & m_sat_sec ; +pLine->m_Type = TYPE_VAR_INT ; +m_LinesVect.push_back( pLine ) ; + pLine = new st_line ; pLine->m_NomVar = "[temps_igc_sec]" ; pLine->m_pVar = (void*) & m_temps_igc_sec ; @@ -78,12 +84,6 @@ pLine->m_pVar = (void*) & m_stab_gps_sec ; pLine->m_Type = TYPE_VAR_INT ; m_LinesVect.push_back( pLine ) ; -pLine = new st_line ; -pLine->m_NomVar = "[sat_sec]" ; -pLine->m_pVar = (void*) & m_sat_sec ; -pLine->m_Type = TYPE_VAR_INT ; -m_LinesVect.push_back( pLine ) ; - pLine = new st_line ; pLine->m_NomVar = "[vz_seuil_haut]" ; pLine->m_pVar = (void*) & m_vz_seuil_haut ; diff --git a/BertheVarioTacPlatformIO/src/GlobalVar/CConfigFile.h b/BertheVarioTacPlatformIO/src/GlobalVar/CConfigFile.h index 1039281..be4d69a 100644 --- a/BertheVarioTacPlatformIO/src/GlobalVar/CConfigFile.h +++ b/BertheVarioTacPlatformIO/src/GlobalVar/CConfigFile.h @@ -4,7 +4,7 @@ /// \brief /// /// \date creation : 08/03/2024 -/// \date modification : 06/10/2024 +/// \date modification : 12/10/2024 /// #ifndef _CCONFIGFILE_ @@ -19,7 +19,7 @@ //////////////////////////////////////////////////////////////////////////////// /// \brief Fichier de configuration de variables sur la carte SD. -class CConfigFile +class CConfigFile : public CNbSatDelay { public : @@ -39,11 +39,10 @@ public : float m_coef_filtre_alti_baro = 0.4 ; ///< coefficient de filtrage [0,1[ , 0.99 tres fort filtrage int m_periode_integration_sec = 2 ; ///< pour le calcul de la Vz int m_vitesse_igc_kmh = 18 ; ///< vitesse de declenchement enregistrement - int m_temps_igc_sec = 6 ; ///< nombre de secondes de vitesse pour declenchement + int m_temps_igc_sec = 3 ; ///< nombre de secondes de vitesse pour declenchement float m_vz_igc_ms = 0.7 ; ///< vz de vitesse pour declenchement int m_stab_gps_metre = 30 ; ///< rayon dispersion gps pour stabilite int m_stab_gps_sec = 10 ; ///< taille pile en sec pour calcul rayon dispersion gps - int m_sat_sec = 7 ; ///< secondes d'interdiction debut vol vitesse cause changement nombre satellites float m_vz_seuil_max = 4. ; ///< seuils de beep float m_vz_seuil_haut = 0.2 ; ///< seuils de beep float m_vz_seuil_bas = -2.5 ; ///< seuils de beep @@ -65,6 +64,11 @@ public : std::vector< st_line *> m_LinesVect ; ///< vecteur des lignes champs/variable static void ReplaceCharIn( std::string & str , char cfind , char creplace ) ; + + friend CNbSatDelay ; + +protected : + int m_sat_sec = 9 ; ///< secondes d'interdiction debut vol vitesse cause changement nombre satellites (pour 4 satellites) } ; #endif diff --git a/BertheVarioTacPlatformIO/src/GlobalVar/CGlobalVar.cpp b/BertheVarioTacPlatformIO/src/GlobalVar/CGlobalVar.cpp index 1d9c7f4..62a9701 100644 --- a/BertheVarioTacPlatformIO/src/GlobalVar/CGlobalVar.cpp +++ b/BertheVarioTacPlatformIO/src/GlobalVar/CGlobalVar.cpp @@ -4,7 +4,7 @@ /// \brief Variable globale /// /// \date creation : 20/09/2024 -/// \date modification : 10/10/2024 +/// \date modification : 12/10/2024 /// #include "../BertheVarioTac.h" @@ -26,6 +26,16 @@ m_pCapteurPression = NULL ; #endif } +/////////////////////////////////////////////////////////////////////////////// +/// \brief Pour un gain memoire +void CGlobalVar::GainMemoire() +{ +RazGpsPos() ; +m_PileVit.ResetVit() ; +m_HistoVol.m_HistoDir.clear() ; +m_Config.FreeVect() ; +} + //////////////////////////////////////////////////////////////////////////////// /// \brief Renvoie l'angle signe en degres entre A et B. float CGlobalVar::GetDiffAngle( float AngleA , float AngleB ) diff --git a/BertheVarioTacPlatformIO/src/GlobalVar/CGlobalVar.h b/BertheVarioTacPlatformIO/src/GlobalVar/CGlobalVar.h index 91bde08..d898524 100644 --- a/BertheVarioTacPlatformIO/src/GlobalVar/CGlobalVar.h +++ b/BertheVarioTacPlatformIO/src/GlobalVar/CGlobalVar.h @@ -4,7 +4,7 @@ /// \brief Variable globale /// /// \date creation : 21/09/2024 -/// \date modification : 10/10/2024 +/// \date modification : 12/10/2024 /// #ifndef _GLOBALVAR_ @@ -27,6 +27,7 @@ public : bool BoutonDroit() { return m_Screen.IsButtonPressed(2) ; } ; void PurgeBoutons( int DelaySec ) ; + void GainMemoire() ; CScreen m_Screen ; CConfigFile m_Config ; ///< variables issues du fichier de config diff --git a/BertheVarioTacPlatformIO/src/GlobalVar/CNbSatDelay.cpp b/BertheVarioTacPlatformIO/src/GlobalVar/CNbSatDelay.cpp new file mode 100644 index 0000000..7649cbc --- /dev/null +++ b/BertheVarioTacPlatformIO/src/GlobalVar/CNbSatDelay.cpp @@ -0,0 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +/// \file CNbSatDelay.cpp +/// +/// \brief +/// +/// \date creation : 12/10/2024 +/// \date modification : 12/10/2024 +/// + +#include "../BertheVarioTac.h" + +//////////////////////////////////////////////////////////////////////////////// +/// \brief Renvoi le temps en secondes d'attente apres un changement de nombre +/// de satellites en vue. +/// \return m_sat_sec : si 4 satellites. +/// \return 0 : si 26 satellites. +int CNbSatDelay::GetNbSatDelay(int NbSat) const +{ +float SecDelay = -((float)(g_GlobalVar.m_Config.m_sat_sec))*((float)NbSat)/22. + ((float)(g_GlobalVar.m_Config.m_sat_sec))*26./22. ; +return (int)SecDelay ; +} diff --git a/BertheVarioTacPlatformIO/src/GlobalVar/CNbSatDelay.h b/BertheVarioTacPlatformIO/src/GlobalVar/CNbSatDelay.h new file mode 100644 index 0000000..1f42307 --- /dev/null +++ b/BertheVarioTacPlatformIO/src/GlobalVar/CNbSatDelay.h @@ -0,0 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +/// \file CNbSatDelay.h +/// +/// \brief +/// +/// \date creation : 12/10/2024 +/// \date modification : 12/10/2024 +/// + +#ifndef _NBSATDELAY_ +#define _NBSATDELAY_ + +//////////////////////////////////////////////////////////////////////////////// +/// \brief Temps d'attente decroissant avec le nombre de satelittes en vue. +class CNbSatDelay +{ +public : + int GetNbSatDelay( int NbSat ) const ; +} ; + +#endif diff --git a/BertheVarioTacPlatformIO/src/Gps/CGps.cpp b/BertheVarioTacPlatformIO/src/Gps/CGps.cpp index 50becef..3cede63 100644 --- a/BertheVarioTacPlatformIO/src/Gps/CGps.cpp +++ b/BertheVarioTacPlatformIO/src/Gps/CGps.cpp @@ -4,7 +4,7 @@ /// \brief /// /// \date creation : 03/03/2024 -/// \date modification : 09/10/2024 +/// \date modification : 12/10/2024 /// #include "../BertheVarioTac.h" @@ -180,7 +180,7 @@ while ( g_GlobalVar.m_TaskArr[TEMPS_NUM_TASK].m_Run ) if ( fabs(g_GlobalVar.m_VitVertMS) >= g_GlobalVar.m_Config.m_vz_igc_ms ) { iVz++ ; - if ( iVz >= 3 ) + if ( iVz >= g_GlobalVar.m_Config.m_temps_igc_sec ) break ; } else @@ -188,9 +188,7 @@ while ( g_GlobalVar.m_TaskArr[TEMPS_NUM_TASK].m_Run ) } // pour gain memoire -g_GlobalVar.RazGpsPos() ; -g_GlobalVar.m_PileVit.ResetVit() ; -g_GlobalVar.m_HistoVol.m_HistoDir.clear() ; +g_GlobalVar.GainMemoire() ; // derniere configuration des zones g_GlobalVar.m_ZonesAerAll.SetDatePeriode() ; diff --git a/BertheVarioTacPlatformIO/src/Gps/CPileVit.cpp b/BertheVarioTacPlatformIO/src/Gps/CPileVit.cpp index 0982c08..17f0fe6 100644 --- a/BertheVarioTacPlatformIO/src/Gps/CPileVit.cpp +++ b/BertheVarioTacPlatformIO/src/Gps/CPileVit.cpp @@ -4,7 +4,7 @@ /// \brief /// /// \date creation : 02/09/2024 -/// \date modification : 02/10/2024 +/// \date modification : 12/10/2024 /// #include "../BertheVarioTac.h" @@ -42,8 +42,9 @@ if ( g_GlobalVar.m_VitesseKmh < g_GlobalVar.m_Config.m_vitesse_igc_kmh || return ; } -// si reconfig fichier config -if ( m_TaillePile != g_GlobalVar.m_Config.m_temps_igc_sec ) +// si changement de nombre de satellites +int TaillePile = g_GlobalVar.m_Config.m_temps_igc_sec ; +if ( m_TaillePile != TaillePile ) { if ( m_PosArr != NULL ) delete [] m_PosArr ; @@ -55,7 +56,7 @@ if ( m_TaillePile != g_GlobalVar.m_Config.m_temps_igc_sec ) // allocation tableau if ( m_PosArr == NULL ) { - m_TaillePile = g_GlobalVar.m_Config.m_temps_igc_sec ; + m_TaillePile = TaillePile ; m_PosArr = new float[m_TaillePile] ; } @@ -88,7 +89,7 @@ if ( m_PosArr != NULL ) /// satellites en vue modifiés (recalage position/vitesse). void CPileVit::SatChange() { -m_ipile = -g_GlobalVar.m_Config.m_sat_sec ; +m_ipile = -g_GlobalVar.m_Config.GetNbSatDelay( g_GlobalVar.GetNbSat() ) ; m_pile_full = false ; } diff --git a/BertheVarioTacPlatformIO/src/Gps/CTrame.h b/BertheVarioTacPlatformIO/src/Gps/CTrame.h index ba96e74..b3f1e81 100644 --- a/BertheVarioTacPlatformIO/src/Gps/CTrame.h +++ b/BertheVarioTacPlatformIO/src/Gps/CTrame.h @@ -4,7 +4,7 @@ /// \brief /// /// \date creation : 03/03/2024 -/// \date modification : 03/09/2024 +/// \date modification : 12/10/2024 /// #ifndef _TRAME_ @@ -17,7 +17,7 @@ class CTrame public : void Push(char c) ; - static int GetNbSat() + static int GetNbSat() ///< nombre de satellites en vue { return m_NombreSatellite ; } ; protected : diff --git a/BertheVarioTacPlatformIO/src/Screen/CAutoPages.cpp b/BertheVarioTacPlatformIO/src/Screen/CAutoPages.cpp index 092b36a..cdea95a 100644 --- a/BertheVarioTacPlatformIO/src/Screen/CAutoPages.cpp +++ b/BertheVarioTacPlatformIO/src/Screen/CAutoPages.cpp @@ -4,7 +4,7 @@ /// \brief Automate de sequencement des pages ecran /// /// \date creation : 21/09/2024 -/// \date modification : 05/10/2024 +/// \date modification : 12/10/2024 /// #include "../BertheVarioTac.h" @@ -73,9 +73,9 @@ if ( m_EtatAuto != NextStep ) // pour retour automatique vers Vz_0 m_MillisEcran0 = millis() ; - // raz screen si changement ecran - //ScreenRaz() ; + // changement page m_PageChanged = true ; + g_GlobalVar.GainMemoire() ; unsigned long time = millis() ; while( (millis()-time) < 200 ) @@ -104,8 +104,8 @@ else if( (millis()-m_MillisEcran0)/1000 > m_SecondesRetourEcran0 ) { ScreenRaz() ; - //ScreenRazButtons() ; m_PageChanged = true ; + g_GlobalVar.GainMemoire() ; m_EtatAuto = ECRAN_0_Vz ; return ; } diff --git a/BertheVarioTacPlatformIO/src/Screen/CScreen.cpp b/BertheVarioTacPlatformIO/src/Screen/CScreen.cpp index ee0f4ad..36a5384 100644 --- a/BertheVarioTacPlatformIO/src/Screen/CScreen.cpp +++ b/BertheVarioTacPlatformIO/src/Screen/CScreen.cpp @@ -4,7 +4,7 @@ /// \brief Definition des pages ecran /// /// \date creation : 21/09/2024 -/// \date modification : 10/10/2024 +/// \date modification : 12/10/2024 /// #include "../BertheVarioTac.h" @@ -723,24 +723,24 @@ static char TmpModChar[100] = {0} ; std::string Name ; std::string Value ; ; -static bool ChampsModified = false ; -static int m_LastiChamps = -2 ; -static bool CfgFileEnMod = false ; +static bool s_ChampsModified = false ; +static int s_LastiChamps = -2 ; +static bool s_CfgFileEnMod = false ; // à l'entree dans la page on a rien modifier if ( IsPageChanged() ) { g_GlobalVar.m_Config.ConstructVect() ; m_CfgFileiChamps = -1 ; - ChampsModified = false ; - m_LastiChamps = -2 ; + s_ChampsModified = false ; + s_LastiChamps = -2 ; } // on modifie la luminosite en direct g_tft.setBrightness( g_GlobalVar.m_Config.m_luminosite ) ; // texte bouton -if ( CfgFileEnMod ) +if ( s_CfgFileEnMod ) { g_GlobalVar.m_Screen.SetText( " - " , 0 ) ; g_GlobalVar.m_Screen.SetText( "Val", 1 ) ; @@ -767,14 +767,16 @@ if ( m_CfgFileiChamps == -1 ) { strcpy( TmpModChar , "" ) ; Name = " Editeur Cfg file" ; + s_ChampsModified = false ; + s_LastiChamps = -2 ; } else g_GlobalVar.m_Config.GetChar( m_CfgFileiChamps , Name , Value ) ; // changement de champ -if ( m_LastiChamps != m_CfgFileiChamps ) +if ( s_LastiChamps != m_CfgFileiChamps ) { - m_LastiChamps = m_CfgFileiChamps ; + s_LastiChamps = m_CfgFileiChamps ; ScreenRaz() ; g_tft.setTextSize(2) ; @@ -806,24 +808,35 @@ if ( BoutonCent && !CfgFileEnMod && m_CfgFileiChamps == -1 ) } */ // modification du mode modif/edition -if ( BoutonCent && m_CfgFileiChamps != -1 ) +if ( BoutonCent ) { - ScreenRaz() ; - CfgFileEnMod = !CfgFileEnMod ; - if ( CfgFileEnMod ) - strcpy( TmpModChar , "Modification" ) ; - else + if ( m_CfgFileiChamps != -1 ) { - strcpy( TmpModChar , "Edition" ) ; - if ( ChampsModified ) - g_GlobalVar.m_Config.EcritureFichier() ; + ScreenRaz() ; + s_CfgFileEnMod = !s_CfgFileEnMod ; + if ( s_CfgFileEnMod ) + strcpy( TmpModChar , "Modification" ) ; + else + { + strcpy( TmpModChar , "Edition" ) ; + if ( s_ChampsModified ) + { + g_GlobalVar.m_Config.EcritureFichier() ; + g_GlobalVar.m_Config.ConstructVect() ; + } + s_ChampsModified = false ; + //s_LastiChamps = -2 ; + //m_CfgFileiChamps = -1 ; + } } + else + s_CfgFileEnMod = false ; } // decrementation de variable -if ( BoutonGau && CfgFileEnMod ) +if ( BoutonGau && s_CfgFileEnMod && m_CfgFileiChamps >= 0 && m_CfgFileiChamps < g_GlobalVar.m_Config.m_LinesVect.size() ) { - ChampsModified = true ; + s_ChampsModified = true ; CConfigFile::st_line * pLine = g_GlobalVar.m_Config.m_LinesVect[m_CfgFileiChamps] ; if ( pLine->m_Type == TYPE_VAR_FLOAT ) { @@ -847,9 +860,9 @@ if ( BoutonGau && CfgFileEnMod ) } // incrementation de variable -if ( BoutonDroi && CfgFileEnMod ) +if ( BoutonDroi && s_CfgFileEnMod && m_CfgFileiChamps >= 0 && m_CfgFileiChamps < g_GlobalVar.m_Config.m_LinesVect.size() ) { - ChampsModified = true ; + s_ChampsModified = true ; CConfigFile::st_line * pLine = g_GlobalVar.m_Config.m_LinesVect[m_CfgFileiChamps] ; if ( pLine->m_Type == TYPE_VAR_FLOAT ) { @@ -872,8 +885,8 @@ if ( BoutonDroi && CfgFileEnMod ) g_GlobalVar.m_Screen.ScreenRaz() ; } -// defilement -if ( BoutonGau && !CfgFileEnMod ) +// defilement variable gauche +if ( BoutonGau && !s_CfgFileEnMod ) { if ( m_CfgFileiChamps > -1 ) m_CfgFileiChamps-- ; @@ -881,7 +894,8 @@ if ( BoutonGau && !CfgFileEnMod ) m_CfgFileiChamps = g_GlobalVar.m_Config.m_LinesVect.size()-1 ; } -if ( BoutonDroi && !CfgFileEnMod ) +// defilement variable droite +if ( BoutonDroi && !s_CfgFileEnMod ) { int size = (g_GlobalVar.m_Config.m_LinesVect.size()-1) ; if ( m_CfgFileiChamps < size ) diff --git a/Codeblocks/Codeblocks.cbp b/Codeblocks/Codeblocks.cbp index 5061a31..364e106 100644 --- a/Codeblocks/Codeblocks.cbp +++ b/Codeblocks/Codeblocks.cbp @@ -64,6 +64,8 @@ + + diff --git a/Codeblocks/Codeblocks.layout b/Codeblocks/Codeblocks.layout index 9639bd6..ff8c20b 100644 --- a/Codeblocks/Codeblocks.layout +++ b/Codeblocks/Codeblocks.layout @@ -2,134 +2,144 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + @@ -137,164 +147,164 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -302,24 +312,24 @@ - + - + - + - + - + - + - + - + diff --git a/documentation/DocUtilisateurBertheVarioTac.odt b/documentation/DocUtilisateurBertheVarioTac.odt index 8fb6ce6..af2167b 100644 Binary files a/documentation/DocUtilisateurBertheVarioTac.odt and b/documentation/DocUtilisateurBertheVarioTac.odt differ diff --git a/documentation/DocUtilisateurBertheVarioTac.pdf b/documentation/DocUtilisateurBertheVarioTac.pdf index 9c86b34..fe9e354 100644 Binary files a/documentation/DocUtilisateurBertheVarioTac.pdf and b/documentation/DocUtilisateurBertheVarioTac.pdf differ diff --git a/version.txt b/version.txt index 5b197b5..a448f61 100644 --- a/version.txt +++ b/version.txt @@ -1,3 +1,9 @@ +le 20241012a : + - [temps_igc_ms] passe à 3s par defaut. + - Vz declenclement de vol pendant [temps_igc_ms]. + - [sat_sec] 9s par defaut pour 4 satellites (puis 0s pour 26 satellites). + - correction bug editeur cfg file. + le 20241010b : - essai mesure luminosite.