Skip to content

Commit

Permalink
[temps_igc_ms] et [sat_sec]
Browse files Browse the repository at this point in the history
  • Loading branch information
gitberthe committed Oct 12, 2024
1 parent e6b8734 commit 7279c73
Show file tree
Hide file tree
Showing 18 changed files with 268 additions and 179 deletions.
2 changes: 1 addition & 1 deletion BertheVarioTacPlatformIO/src/BertheVarioTac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "BertheVarioTac.h"

char g_NumVersion[] = "20241010b" ;
char g_NumVersion[] = "20241012a" ;

////////////////////////////////////////////////////////////////////////////////
/// \brief Affiche le nom et le firmware
Expand Down
3 changes: 2 additions & 1 deletion BertheVarioTacPlatformIO/src/BertheVarioTac.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
///


Expand Down Expand Up @@ -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"
Expand Down
14 changes: 7 additions & 7 deletions BertheVarioTacPlatformIO/src/GlobalVar/CConfigFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/// \brief
///
/// \date creation : 08/03/2024
/// \date modification : 02/10/2024
/// \date modification : 12/10/2024
///

#include "../BertheVarioTac.h"
Expand Down Expand Up @@ -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 ;
Expand All @@ -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 ;
Expand Down
12 changes: 8 additions & 4 deletions BertheVarioTacPlatformIO/src/GlobalVar/CConfigFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/// \brief
///
/// \date creation : 08/03/2024
/// \date modification : 06/10/2024
/// \date modification : 12/10/2024
///

#ifndef _CCONFIGFILE_
Expand All @@ -19,7 +19,7 @@

////////////////////////////////////////////////////////////////////////////////
/// \brief Fichier de configuration de variables sur la carte SD.
class CConfigFile
class CConfigFile : public CNbSatDelay
{
public :

Expand All @@ -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
Expand All @@ -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
12 changes: 11 additions & 1 deletion BertheVarioTacPlatformIO/src/GlobalVar/CGlobalVar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 )
Expand Down
3 changes: 2 additions & 1 deletion BertheVarioTacPlatformIO/src/GlobalVar/CGlobalVar.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/// \brief Variable globale
///
/// \date creation : 21/09/2024
/// \date modification : 10/10/2024
/// \date modification : 12/10/2024
///

#ifndef _GLOBALVAR_
Expand All @@ -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
Expand Down
21 changes: 21 additions & 0 deletions BertheVarioTacPlatformIO/src/GlobalVar/CNbSatDelay.cpp
Original file line number Diff line number Diff line change
@@ -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 ;
}
21 changes: 21 additions & 0 deletions BertheVarioTacPlatformIO/src/GlobalVar/CNbSatDelay.h
Original file line number Diff line number Diff line change
@@ -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
8 changes: 3 additions & 5 deletions BertheVarioTacPlatformIO/src/Gps/CGps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/// \brief
///
/// \date creation : 03/03/2024
/// \date modification : 09/10/2024
/// \date modification : 12/10/2024
///

#include "../BertheVarioTac.h"
Expand Down Expand Up @@ -180,17 +180,15 @@ 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
iVz = 0 ;
}

// 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() ;
Expand Down
11 changes: 6 additions & 5 deletions BertheVarioTacPlatformIO/src/Gps/CPileVit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/// \brief
///
/// \date creation : 02/09/2024
/// \date modification : 02/10/2024
/// \date modification : 12/10/2024
///

#include "../BertheVarioTac.h"
Expand Down Expand Up @@ -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 ;
Expand All @@ -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] ;
}

Expand Down Expand Up @@ -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 ;
}

Expand Down
4 changes: 2 additions & 2 deletions BertheVarioTacPlatformIO/src/Gps/CTrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/// \brief
///
/// \date creation : 03/03/2024
/// \date modification : 03/09/2024
/// \date modification : 12/10/2024
///

#ifndef _TRAME_
Expand All @@ -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 :
Expand Down
8 changes: 4 additions & 4 deletions BertheVarioTacPlatformIO/src/Screen/CAutoPages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 )
Expand Down Expand Up @@ -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 ;
}
Expand Down
Loading

0 comments on commit 7279c73

Please sign in to comment.