kopia lustrzana https://github.com/pjalocha/esp32-ogn-tracker
Disable the sleep mode for now
rodzic
a1a1dca5c3
commit
61dadc2408
|
@ -219,9 +219,10 @@ static void ProcessCtrlC(void) // print system
|
||||||
Format_String(CONS_UART_Write, "kB total, "); }
|
Format_String(CONS_UART_Write, "kB total, "); }
|
||||||
Format_UnsDec(CONS_UART_Write, Files);
|
Format_UnsDec(CONS_UART_Write, Files);
|
||||||
Format_String(CONS_UART_Write, " files\n");
|
Format_String(CONS_UART_Write, " files\n");
|
||||||
|
#endif // WITH_SPIFFS
|
||||||
|
|
||||||
Parameters.Write(CONS_UART_Write); // write the parameters to the console
|
Parameters.Write(CONS_UART_Write); // write the parameters to the console
|
||||||
// Parameters.WriteFile(stdout); // write the parameters to the stdout
|
// Parameters.WriteFile(stdout); // write the parameters to the stdout
|
||||||
#endif // WITH_SPIFFS
|
|
||||||
|
|
||||||
#ifdef WITH_SD
|
#ifdef WITH_SD
|
||||||
Format_String(CONS_UART_Write, "SD card:");
|
Format_String(CONS_UART_Write, "SD card:");
|
||||||
|
|
|
@ -407,7 +407,10 @@ static void GPS_NMEA(void) // wh
|
||||||
if(Button_SleepRequest)
|
if(Button_SleepRequest)
|
||||||
{
|
{
|
||||||
#ifdef WITH_GPS_MTK
|
#ifdef WITH_GPS_MTK
|
||||||
Format_String(GPS_UART_Write, "$PMTK225,4*2F\r\n", 15, 0); // request to the GPS to enter sleep
|
#ifdef WITH_GPS_ENABLE
|
||||||
|
GPS_DISABLE();
|
||||||
|
#endif
|
||||||
|
Format_String(GPS_UART_Write, /* "$PMTK161,0*28\r\n", */ "$PMTK225,4*2F\r\n", 15, 0); // 225 or "$PMTK161,0*28\r\n" request to the GPS to enter sleep
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_PRINT
|
#ifdef DEBUG_PRINT
|
||||||
|
@ -851,5 +854,3 @@ void vTaskGPS(void* pvParameters)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
63
main/hal.cpp
63
main/hal.cpp
|
@ -898,48 +898,67 @@ void LED_TimerCheck(uint8_t Ticks)
|
||||||
|
|
||||||
bool Button_SleepRequest = 0;
|
bool Button_SleepRequest = 0;
|
||||||
|
|
||||||
|
uint32_t Button_PressTime=0; // [ms] counts for how long the button is kept pressed
|
||||||
|
uint32_t Button_ReleaseTime=0;
|
||||||
|
|
||||||
const int8_t Button_FilterTime = 20; // [ms]
|
const int8_t Button_FilterTime = 20; // [ms]
|
||||||
const int8_t Button_FilterThres = Button_FilterTime/2;
|
const int8_t Button_FilterThres = Button_FilterTime/2;
|
||||||
static int8_t Button_Filter=(-Button_FilterTime);
|
static int8_t Button_Filter=(-Button_FilterTime);
|
||||||
|
|
||||||
void Sleep(void)
|
// void Sleep(void)
|
||||||
{
|
// {
|
||||||
// #ifdef PIN_PERIPH_RST
|
// #ifdef PIN_PERIPH_RST
|
||||||
// gpio_set_level(PIN_PERIPH_RST, 0);
|
// gpio_set_level(PIN_PERIPH_RST, 0);
|
||||||
// #endif
|
// #endif
|
||||||
#ifdef PIN_GPS_ENA
|
// #ifdef PIN_GPS_ENA
|
||||||
gpio_set_level(PIN_GPS_ENA, 0);
|
// gpio_set_level(PIN_GPS_ENA, 0);
|
||||||
#endif
|
// #endif
|
||||||
esp_light_sleep_start();
|
// esp_light_sleep_start();
|
||||||
Button_SleepRequest = 0;
|
// Button_SleepRequest = 0;
|
||||||
|
// Button_PressTime=0;
|
||||||
// #ifdef PIN_PERIPH_RST
|
// #ifdef PIN_PERIPH_RST
|
||||||
// gpio_set_level(PIN_PERIPH_RST, 0);
|
// gpio_set_level(PIN_PERIPH_RST, 0);
|
||||||
//
|
//
|
||||||
// gpio_set_level(PIN_PERIPH_RST, 1);
|
// gpio_set_level(PIN_PERIPH_RST, 1);
|
||||||
// #endif
|
// #endif
|
||||||
|
// }
|
||||||
|
|
||||||
|
static void Button_keptPressed(uint8_t Ticks)
|
||||||
|
{ Button_PressTime+=Ticks;
|
||||||
|
// Button_SleepRequest = Button_PressTime>=30000; // [ms] setup SleepRequest if button pressed for >= 4sec
|
||||||
|
// if(Button_PressTime>=32000)
|
||||||
|
// { Format_String(CONS_UART_Write, "Sleep in 2 sec\n");
|
||||||
|
// vTaskDelay(2000);
|
||||||
|
// Sleep(); }
|
||||||
|
|
||||||
|
if(Button_ReleaseTime)
|
||||||
|
{ Format_String(CONS_UART_Write, "Button pressed:");
|
||||||
|
Format_UnsDec(CONS_UART_Write, Button_PressTime);
|
||||||
|
Format_String(CONS_UART_Write, "\n");
|
||||||
|
}
|
||||||
|
Button_ReleaseTime=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Button_PressTime=0; // [ms] counts for how long the button is kept pressed
|
static void Button_keptReleased(uint8_t Ticks)
|
||||||
void Button_keptPressed(uint8_t Ticks)
|
{ Button_ReleaseTime+=Ticks;
|
||||||
{ Button_PressTime+=Ticks;
|
|
||||||
Button_SleepRequest = Button_PressTime>=4000; } // [ms] setup SleepRequest if button pressed for >= 4sec
|
|
||||||
|
|
||||||
void Button_keptReleased(uint8_t Ticks)
|
|
||||||
{
|
|
||||||
if(Button_PressTime)
|
if(Button_PressTime)
|
||||||
{ Format_String(CONS_UART_Write, "Button released:");
|
{ Format_String(CONS_UART_Write, "Button released:");
|
||||||
Format_UnsDec(CONS_UART_Write, Button_PressTime);
|
Format_UnsDec(CONS_UART_Write, Button_PressTime);
|
||||||
Format_String(CONS_UART_Write, "\n");
|
Format_String(CONS_UART_Write, "\n");
|
||||||
if(Button_SleepRequest)
|
|
||||||
{ Format_String(CONS_UART_Write, "Sleep in 1 sec\n");
|
// if(Button_SleepRequest)
|
||||||
vTaskDelay(1000);
|
// { Format_String(CONS_UART_Write, "Sleep in 2 sec\n");
|
||||||
Sleep(); }
|
// vTaskDelay(2000);
|
||||||
|
// Sleep(); }
|
||||||
|
|
||||||
}
|
}
|
||||||
Button_PressTime=0; }
|
Button_PressTime=0;
|
||||||
|
}
|
||||||
|
|
||||||
void Button_TimerCheck(uint8_t Ticks)
|
void Button_TimerCheck(uint8_t Ticks)
|
||||||
{
|
{
|
||||||
#ifdef PIN_BUTTON
|
#ifdef PIN_BUTTON
|
||||||
|
// CONS_UART_Write(Button_isPressed()?'^':'_');
|
||||||
if(Button_isPressed())
|
if(Button_isPressed())
|
||||||
{ Button_Filter+=Ticks; if(Button_Filter>Button_FilterTime) Button_Filter=Button_FilterTime;
|
{ Button_Filter+=Ticks; if(Button_Filter>Button_FilterTime) Button_Filter=Button_FilterTime;
|
||||||
if(Button_Filter>=Button_FilterThres) { Button_keptPressed(Ticks); }
|
if(Button_Filter>=Button_FilterThres) { Button_keptPressed(Ticks); }
|
||||||
|
@ -1052,7 +1071,11 @@ void IO_Configuration(void)
|
||||||
#endif
|
#endif
|
||||||
#ifdef PIN_GPS_ENA
|
#ifdef PIN_GPS_ENA
|
||||||
gpio_set_direction(PIN_GPS_ENA, GPIO_MODE_OUTPUT);
|
gpio_set_direction(PIN_GPS_ENA, GPIO_MODE_OUTPUT);
|
||||||
gpio_set_level(PIN_GPS_ENA, 1);
|
#ifdef WITH_GPS_MTK
|
||||||
|
gpio_set_level(PIN_GPS_ENA, 0); //
|
||||||
|
#else
|
||||||
|
gpio_set_level(PIN_GPS_ENA, 1); //
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef GPS_UART
|
#ifdef GPS_UART
|
||||||
|
|
|
@ -105,6 +105,10 @@ void GPS_UART_Write (char Byte); // blocking
|
||||||
void GPS_UART_SetBaudrate(int BaudRate);
|
void GPS_UART_SetBaudrate(int BaudRate);
|
||||||
|
|
||||||
bool GPS_PPS_isOn(void);
|
bool GPS_PPS_isOn(void);
|
||||||
|
#ifdef WITH_GPS_ENABLE
|
||||||
|
void GPS_ENABLE(void);
|
||||||
|
void GPS_DISABLE(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
// #ifdef WITH_ADSB
|
// #ifdef WITH_ADSB
|
||||||
int ADSB_UART_Read (uint8_t &Byte); // non-blocking
|
int ADSB_UART_Read (uint8_t &Byte); // non-blocking
|
||||||
|
|
|
@ -315,6 +315,8 @@ void vTaskSENS(void* pvParameters)
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
|
if(Button_SleepRequest)
|
||||||
|
{ vTaskDelay(1000); }
|
||||||
#if defined(WITH_BMP180) || defined(WITH_BMP280) || defined(WITH_MS5607) || defined(WITH_BME280)
|
#if defined(WITH_BMP180) || defined(WITH_BMP280) || defined(WITH_MS5607) || defined(WITH_BME280)
|
||||||
ProcBaro();
|
ProcBaro();
|
||||||
#else
|
#else
|
||||||
|
|
Ładowanie…
Reference in New Issue