Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.1.9 Release #255

Merged
merged 61 commits into from
Dec 11, 2024
Merged
Changes from 4 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
16a4a28
chore: Update version
jgauchia Nov 13, 2024
4b76d94
build: Update libraries
jgauchia Nov 13, 2024
4872359
fix(gps): Maintain last fixed coordinates after fix
jgauchia Nov 13, 2024
0ec3538
build: Fix espressif version
jgauchia Nov 14, 2024
5a9e259
feat(wpt): Add back button in waypoint add/edit screen
jgauchia Nov 14, 2024
6877719
fix(wpt): Fix waypoint add/edit rotation button size
jgauchia Nov 14, 2024
cff1c7a
docs: Update README.md
jgauchia Nov 15, 2024
fff3bfc
fix(board): Fix elecrow board definition
jgauchia Nov 15, 2024
043dd1b
docs: Update README.md
jgauchia Nov 15, 2024
f91aed0
fix(board): Fix IceNav board definition
jgauchia Nov 15, 2024
cd6d568
refactor(cli): Delete settings option from CLI
jgauchia Nov 16, 2024
2a21a63
fix(cli): Fix poweroff CLI option
jgauchia Nov 16, 2024
6a02981
fix(power): Fix deep sleep for IceNav board
jgauchia Nov 16, 2024
8038ff6
feat(cli): Add GMT user settings (kset) in CLI #159
jgauchia Nov 17, 2024
36bb089
refactor(storage): Refactor to class
jgauchia Nov 17, 2024
9a4ae48
refactor(battery): Refactor to class
jgauchia Nov 17, 2024
cf8ed80
build: Clear unused variables
jgauchia Nov 17, 2024
2fc21c9
refactor(power): Refactor to class
jgauchia Nov 17, 2024
4b4f199
refactor: Clean Code
jgauchia Nov 24, 2024
e13d5cf
fix(webserver): Fix drag an drop upload background and file names
jgauchia Nov 24, 2024
e9c84cf
fix(webfile): Fix file delete message
jgauchia Nov 24, 2024
60cabcb
feat(cli): Add set DST zone CLI command
jgauchia Nov 24, 2024
44f97f4
Merge branch 'devel' into devel_refactor
jgauchia Nov 24, 2024
373f4ec
Update cli.cpp
jgauchia Nov 24, 2024
2aa43be
Merge pull request #256 from jgauchia/devel_refactor
jgauchia Nov 24, 2024
dc0cc6f
feat(webserver): Add folder upload
jgauchia Nov 25, 2024
f2a2581
fix(webserver): Fix single file upload
jgauchia Nov 25, 2024
bed83a3
feat(webserver): Add folder delete button
jgauchia Nov 26, 2024
91132b9
fix(webserver): Fix folder upload browser compat.
jgauchia Nov 26, 2024
0c6e704
feat(webserver): Delete folders
jgauchia Nov 27, 2024
e411138
fix(webserver): Fix delete folder
jgauchia Nov 27, 2024
5c1f0e6
fix(webserver): Fix download file
jgauchia Nov 27, 2024
9253091
feat(webserver): Add pagination
jgauchia Nov 27, 2024
b21dce6
feat(webserver): Add path info in status
jgauchia Nov 27, 2024
2fdf706
Merge pull request #257 from jgauchia/devel_webfile
jgauchia Nov 27, 2024
6f0114f
feat: Add Sunrise and Sunset Calculation
jgauchia Dec 1, 2024
b8dfd00
build: Update LovyanGFX library
jgauchia Dec 1, 2024
311436c
feat: Change default Tile if Search satellite skipped
jgauchia Dec 1, 2024
483923e
fix(timer): Fix main app Timer init.
jgauchia Dec 1, 2024
acaf549
refactor(settings): Refactor device settings code
jgauchia Dec 1, 2024
4ac533e
feat(firmware): Add firmware upgrade from SD Card
jgauchia Dec 2, 2024
4b9a158
fix(firmware): Fix upgrade progress typo
jgauchia Dec 2, 2024
6167e27
docs: Update README.md
jgauchia Dec 2, 2024
cb1a908
Merge pull request #259 from jgauchia/devel_upgrade
jgauchia Dec 2, 2024
6e9f12a
Merge branch 'devel' into devel_solar
jgauchia Dec 3, 2024
f25a4d7
feat(widgets): Add sunrise/sunset widget
jgauchia Dec 3, 2024
1544636
Merge pull request #258 from jgauchia/devel_solar
jgauchia Dec 3, 2024
69ea970
fix(main): Fix splash screen memory free info
jgauchia Dec 4, 2024
e1475c2
fix(vectormap): Fix memory free after map is loaded
jgauchia Dec 4, 2024
787a0a1
feat(vectormap): Preload vectorized map
jgauchia Dec 4, 2024
1a24713
fix(gps): Fix GPS Task init order
jgauchia Dec 4, 2024
bad4e38
fix(gps): Fix GPS time, sunrise and sunset acquire
jgauchia Dec 4, 2024
c2787c2
feat(vectormap): Add boundaries for vectorized map
jgauchia Dec 7, 2024
dcc59e6
feat(vectormap): Add waypoint mark in vectorized map
jgauchia Dec 7, 2024
750bd83
fix(vectormap): Fix vectormap refresh after waypoint selected
jgauchia Dec 8, 2024
c0b4e93
docs: Update README.md
jgauchia Dec 8, 2024
daf695b
fix(splashscr): Add OpenStreetMap attribution
jgauchia Dec 8, 2024
74fc51f
fix(splashscr): Center attribution text
jgauchia Dec 8, 2024
be2f89c
fix(lvgl): Fix touch width screen when rotated
jgauchia Dec 11, 2024
bdf3558
chore: Update version
jgauchia Dec 11, 2024
1bf0a32
chore: Change debug level
jgauchia Dec 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -361,7 +361,8 @@ To access the Web File Server, simply use any browser and go to the following ad
* OSM to binary vectorial maps [OSM_Extract](https://github.com/aresta/OSM_Extract) thanks to [@aresta](https://github.com/aresta)
* Preferences Library [Easy Preferences](https://github.com/hpsaturn/easy-preferences) thanks to [@hpsaturn](https://github.com/hpsaturn)
* Wifi CLI manager [esp32-wifi-cli](https://github.com/hpsaturn/esp32-wifi-cli) thanks to [@hpsaturn](https://github.com/hpsaturn)
* Web file server based in [@smford](https://github.com/smford) [esp32-asyncwebserver-fileupload-example ](https://github.com/smford/esp32-asyncwebserver-fileupload-example)
* Web file server based in [@smford](https://github.com/smford) [esp32-asyncwebserver-fileupload-example](https://github.com/smford/esp32-asyncwebserver-fileupload-example)
* Solar sunset and sunrise [SolarCalculator](https://github.com/jpb10/SolarCalculator) thanks to [@jpb10](https://github.com/jpb10)


---
Binary file added data/sunrise.bin
Binary file not shown.
Binary file added data/sunset.bin
Binary file not shown.
Binary file modified images/dev/compass.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions lib/gps/gps.cpp
Original file line number Diff line number Diff line change
@@ -140,6 +140,12 @@ void getGPSData()
{
adjustTime( fix.dateTime );
localTime = fix.dateTime;
// Calculate Sunrise and Sunset only one time when date & time was valid
if (calcSun)
{
calculateSun();
calcSun = false;
}
}

// Altitude
5 changes: 5 additions & 0 deletions lib/gps/gps.hpp
Original file line number Diff line number Diff line change
@@ -74,10 +74,15 @@ struct GPSDATA
float pdop;
float vdop;
uint8_t satInView;
char sunriseHour[6];
char sunsetHour[6];
};

extern GPSDATA gpsData;

static bool calcSun = true;
void calculateSun();

void initGPS();
double getLat();
double getLon();
22 changes: 22 additions & 0 deletions lib/gps/timezone.hpp
Original file line number Diff line number Diff line change
@@ -98,4 +98,26 @@ static void adjustTime( NeoGPS::time_t & dt )
dt = seconds; // convert seconds back to a date/time structure

}

/**
* @brief convert hour to HH:MM rounded
*
* @param h -> hour
* @param str -> HH:MM text format
*/
static char * hoursToString(double h, char *str)
{
int m = int(round(h * 60));
int hr = (m / 60) % 24;
int mn = m % 60;

str[0] = (hr / 10) % 10 + '0';
str[1] = (hr % 10) + '0';
str[2] = ':';
str[3] = (mn / 10) % 10 + '0';
str[4] = (mn % 10) + '0';
str[5] = '\0';
return str;
}

#endif
10 changes: 10 additions & 0 deletions lib/gui/src/mainScr.cpp
Original file line number Diff line number Diff line change
@@ -60,6 +60,10 @@ void updateCompassScr(lv_event_t * event)
lv_label_set_text_fmt(obj, "%4d m.", gpsData.altitude);
if (obj==speedLabel)
lv_label_set_text_fmt(obj, "%3d Km/h", gpsData.speed);
if (obj==sunriseLabel)
lv_label_set_text_static(obj, gpsData.sunriseHour);
if (obj==sunsetLabel)
lv_label_set_text_static(obj, gpsData.sunsetHour);
}

/**
@@ -158,6 +162,8 @@ void updateMainScreen(lv_timer_t *t)
lv_obj_send_event(longitude, LV_EVENT_VALUE_CHANGED, NULL);
lv_obj_send_event(altitude, LV_EVENT_VALUE_CHANGED, NULL);
lv_obj_send_event(speedLabel, LV_EVENT_VALUE_CHANGED, NULL);
lv_obj_send_event(sunriseLabel, LV_EVENT_VALUE_CHANGED, NULL);
lv_obj_send_event(sunsetLabel, LV_EVENT_VALUE_CHANGED, NULL);
break;

case MAP:
@@ -448,13 +454,17 @@ void createMainScr()
altitudeWidget(compassTile);
// Speed widget
speedWidget(compassTile);
// Sunrise/Sunset widget
sunWidget(compassTile);

// Compass Tile Events
lv_obj_add_event_cb(compassHeading, updateCompassScr, LV_EVENT_VALUE_CHANGED, NULL);
lv_obj_add_event_cb(latitude, updateCompassScr, LV_EVENT_VALUE_CHANGED, NULL);
lv_obj_add_event_cb(longitude, updateCompassScr, LV_EVENT_VALUE_CHANGED, NULL);
lv_obj_add_event_cb(altitude, updateCompassScr, LV_EVENT_VALUE_CHANGED, NULL);
lv_obj_add_event_cb(speedLabel, updateCompassScr, LV_EVENT_VALUE_CHANGED, NULL);
lv_obj_add_event_cb(sunriseLabel, updateCompassScr, LV_EVENT_VALUE_CHANGED, NULL);
lv_obj_add_event_cb(sunsetLabel, updateCompassScr, LV_EVENT_VALUE_CHANGED, NULL);

// Map Tile Toolbar
btnFullScreen = lv_btn_create(mapTile);
39 changes: 39 additions & 0 deletions lib/gui/src/widgets.cpp
Original file line number Diff line number Diff line change
@@ -14,6 +14,8 @@ lv_obj_t *latitude;
lv_obj_t *longitude;
lv_obj_t *altitude;
lv_obj_t *speedLabel;
lv_obj_t *sunriseLabel;
lv_obj_t *sunsetLabel;

/**
* @brief Edit Screen Event (drag widgets)
@@ -211,4 +213,41 @@ void speedWidget(_lv_obj_t *screen)
lv_obj_add_event_cb(obj, editWidget, LV_EVENT_LONG_PRESSED, NULL);
lv_obj_add_event_cb(obj, dragWidget, LV_EVENT_PRESSING, (char *)"Speed_");
lv_obj_add_event_cb(obj, unselectWidget, LV_EVENT_RELEASED, (char *)"Speed_");
}

/**
* @brief Sunrise/Sunset widget
*
* @param screen
*/
void sunWidget(_lv_obj_t *screen)
{
lv_obj_t *obj = lv_obj_create(screen);
lv_obj_set_size(obj, 70 * scale, 60 * scale);
lv_obj_set_pos(obj, sunPosX, sunPosY);
lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE);

sunriseLabel = lv_label_create(obj);
lv_obj_align(sunriseLabel, LV_ALIGN_TOP_RIGHT, 16, -2);
lv_label_set_text_static(sunriseLabel, "");
sunsetLabel = lv_label_create(obj);
lv_obj_align(sunsetLabel,LV_ALIGN_BOTTOM_RIGHT, 16, 10);
lv_label_set_text_static(sunsetLabel, "");

lv_obj_t *img;
img = lv_img_create(obj);
lv_img_set_src(img, sunriseIconFile);
lv_img_set_zoom(img,iconScale);
lv_obj_update_layout(img);
lv_obj_align(img, LV_ALIGN_TOP_LEFT, -10, -10);
img = lv_img_create(obj);
lv_img_set_src(img, sunsetIconFile);
lv_img_set_zoom(img,iconScale);
lv_obj_update_layout(img);
lv_obj_align(img, LV_ALIGN_BOTTOM_LEFT, -10, 10);

objUnselect(obj);
lv_obj_add_event_cb(obj, editWidget, LV_EVENT_LONG_PRESSED, NULL);
lv_obj_add_event_cb(obj, dragWidget, LV_EVENT_PRESSING, (char *)"Sun_");
lv_obj_add_event_cb(obj, unselectWidget, LV_EVENT_RELEASED, (char *)"Sun_");
}
13 changes: 9 additions & 4 deletions lib/gui/src/widgets.hpp
Original file line number Diff line number Diff line change
@@ -24,6 +24,8 @@ extern lv_obj_t *compassHeading;
extern lv_obj_t *compassImg;
extern lv_obj_t *altitude;
extern lv_obj_t *speedLabel;
extern lv_obj_t *sunriseLabel;
extern lv_obj_t *sunsetLabel;

void editWidget(lv_event_t *event);
void dragWidget(lv_event_t *event);
@@ -34,14 +36,17 @@ static bool canMoveWidget = false;
static lv_coord_t newX = 0;
static lv_coord_t newY = 0;

static const char *arrowIconFile PROGMEM = "/arrow.bin"; // Compass Arrow Icon
static const char *positionIconFile PROGMEM = "/pin.bin"; // Position Icon
static const char *altitudeIconFile PROGMEM = "/altit.bin"; // Altitude Icon
static const char *speedIconFile PROGMEM = "/speed.bin"; // Speed Icon
static const char *arrowIconFile PROGMEM = "/arrow.bin"; // Compass Arrow Icon
static const char *positionIconFile PROGMEM = "/pin.bin"; // Position Icon
static const char *altitudeIconFile PROGMEM = "/altit.bin"; // Altitude Icon
static const char *speedIconFile PROGMEM = "/speed.bin"; // Speed Icon
static const char *sunriseIconFile PROGMEM = "/sunrise.bin"; // Sunrise Icon
static const char *sunsetIconFile PROGMEM = "/sunset.bin"; // Sunset Icon

void positionWidget(_lv_obj_t *screen);
void compassWidget(_lv_obj_t *screen);
void altitudeWidget(_lv_obj_t *screen);
void speedWidget(_lv_obj_t *screen);
void sunWidget(_lv_obj_t *screen);

#endif
2 changes: 1 addition & 1 deletion lib/lvgl/lv_conf.h
Original file line number Diff line number Diff line change
@@ -369,7 +369,7 @@

/** Default number of image header cache entries. The cache is used to store the headers of images
* The main logic is like `LV_CACHE_DEF_SIZE` but for image headers. */
#define LV_IMAGE_HEADER_CACHE_DEF_CNT 10
#define LV_IMAGE_HEADER_CACHE_DEF_CNT 15

/** Number of stops allowed per gradient. Increase this to allow more stops.
* This adds (sizeof(lv_color_t) + 1) bytes per additional stop. */
2 changes: 2 additions & 0 deletions lib/preferences/preferences-keys.h
Original file line number Diff line number Diff line change
@@ -13,6 +13,8 @@
X(KALTITUDE_Y, "Altitude_Y", INT) \
X(KSPEED_X, "Speed_X", INT) \
X(KSPEED_Y, "Speed_Y", INT) \
X(KSUN_X, "Sun_X", INT) \
X(KSUN_Y, "Sun_Y", INT) \
X(KCOMP_OFFSET_X, "C_offset_x", FLOAT) \
X(KCOMP_OFFSET_Y, "C_offset_y", FLOAT) \
X(KCOMP_ROT, "Compass_rot", BOOL) \
6 changes: 6 additions & 0 deletions lib/settings/settings.cpp
Original file line number Diff line number Diff line change
@@ -48,6 +48,8 @@ uint16_t altitudePosX = 0; // Altitude widget position X
uint16_t altitudePosY = 0; // Altitude widget position Y
uint16_t speedPosX = 0; // Speed widget position X
uint16_t speedPosY = 0; // Speed widget position Y
uint16_t sunPosX = 0; // Sunrise/sunset position X
uint16_t sunPosY = 0; // Sunrise/sunset position Y
bool enableWeb = true; // Enable/disable web file server
bool showToolBar = false; // Show Map Toolbar
int8_t tempOffset = 0; // BME Temperature offset
@@ -83,6 +85,8 @@ void loadPreferences()
altitudePosY = cfg.getInt(PKEYS::KALTITUDE_Y, TFT_HEIGHT - 170);
speedPosX = cfg.getInt(PKEYS::KSPEED_X, 1);
speedPosY = cfg.getInt(PKEYS::KSPEED_Y, TFT_HEIGHT - 130);
sunPosX = cfg.getInt(PKEYS::KSUN_X, 170);
sunPosY = cfg.getInt(PKEYS::KSUN_Y, TFT_HEIGHT - 170 );
isVectorMap = cfg.getBool(PKEYS::KMAP_VECTOR, false);
defBright = cfg.getUInt(PKEYS::KDEF_BRIGT, 254);
defGMT = cfg.getInt(PKEYS::KGMT_OFFS, 1);
@@ -115,6 +119,8 @@ void loadPreferences()
altitudePosY = cfg.isKey(CONFKEYS::KALTITUDE_Y) ? cfg.getInt(CONFKEYS::KALTITUDE_Y, altitudePosY) : 57;
speedPosX = cfg.isKey(CONFKEYS::KSPEED_X) ? cfg.getInt(CONFKEYS::KSPEED_X, speedPosX) : 3;
speedPosY = cfg.isKey(CONFKEYS::KSPEED_Y) ? cfg.getInt(CONFKEYS::KSPEED_Y, speedPosY) : 94;
sunPosX = cfg.isKey(CONFKEYS::KSUN_X) ? cfg.getInt(CONFKEYS::KSPEED_X, speedPosX) : 3;
sunPosY = cfg.isKey(CONFKEYS::KSUN_Y) ? cfg.getInt(CONFKEYS::KSPEED_Y, speedPosY) : 110;
#endif

battery.setBatteryLevels(cfg.getFloat(PKEYS::KVMAX_BATT,4.2),cfg.getFloat(PKEYS::KVMIN_BATT,3.6));
2 changes: 2 additions & 0 deletions lib/settings/settings.hpp
Original file line number Diff line number Diff line change
@@ -41,6 +41,8 @@ extern uint16_t altitudePosX; // Altitude widget position X
extern uint16_t altitudePosY; // Altitude widget position Y
extern uint16_t speedPosX; // Speed widget position X
extern uint16_t speedPosY; // Speed widget position Y
extern uint16_t sunPosX; // Sunrise/sunset position X
extern uint16_t sunPosY; // Sunrise/sunset position Y
extern bool enableWeb; // Enable/disable web file server
extern int8_t tempOffset; // BME Temperature offset
extern String defDST; // default DST zone
1 change: 1 addition & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
@@ -48,6 +48,7 @@ lib_deps =
hpsaturn/ESP32 Wifi CLI@0.3.3
kubafilinger/AsyncTCP@1.1.1
esphome/ESPAsyncWebServer-esphome@3.3.0
jpb10/SolarCalculator@2.0.1

[esp32_common]
extends = common
25 changes: 24 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@
#include <esp_bt.h>
#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include <SolarCalculator.h>

// Hardware includes
#include "hal.hpp"
@@ -50,10 +51,32 @@ extern Storage storage;
extern Battery battery;
extern Power power;

/**
* @brief Sunrise and Sunset
*
*/
static double transit, sunrise, sunset;

#include "settings.hpp"
#include "lvglSetup.hpp"
#include "tasks.hpp"

/**
* @brief Calculate Sunrise and Sunset
* Must be a global function
*
*/
void calculateSun()
{
calcSunriseSunset(2000 + localTime.year, localTime.month, localTime.date,
gpsData.latitude, gpsData.longitude,
transit, sunrise, sunset);
log_v("%d/%d/%d",2000 + localTime.year, localTime.month, localTime.date);
hoursToString(sunrise + defGMT, gpsData.sunriseHour);
hoursToString(sunset + defGMT, gpsData.sunsetHour);
log_v("Sunrise: %s",gpsData.sunriseHour);
log_v("Sunset: %s",gpsData.sunsetHour);
}

/**
* @brief Setup
@@ -116,6 +139,7 @@ void setup()
mapTempSprite.deleteSprite();
mapTempSprite.createSprite(TILE_WIDTH, TILE_HEIGHT);

// Get init Latitude and Longitude
gpsData.latitude = getLat();
gpsData.longitude = getLon();

@@ -125,7 +149,6 @@ void setup()
}
else
{
// Get init Latitude and Longitude
tileSize = RENDER_TILE_SIZE;
generateRenderMap();
}