Skip to content

Commit

Permalink
Merge pull request #238 from jgauchia/devel_constel
Browse files Browse the repository at this point in the history
New Satellite Constellation Map
  • Loading branch information
jgauchia authored Oct 28, 2024
2 parents 0e1f268 + 33943f6 commit e78746a
Show file tree
Hide file tree
Showing 12 changed files with 542 additions and 318 deletions.
Binary file modified images/dev/satelliteinfo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions lib/gps/gps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ void getGPSData()
satTracker[i].snr = (uint8_t)GPS.satellites[i].snr;
satTracker[i].active = GPS.satellites[i].tracked;
strncpy(satTracker[i].talker_id, GPS.satellites[i].talker_id, 3);
int H = canvasRadius * (90 - satTracker[i].elev) / 90;
satTracker[i].posX = canvasCenter_X + H * sin(DEG2RAD(satTracker[i].azim));
satTracker[i].posY = canvasCenter_Y - H * cos(DEG2RAD(satTracker[i].azim));
}
}

Expand Down
13 changes: 13 additions & 0 deletions lib/gps/gps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
#include "settings.hpp"
#include "timezone.hpp"

#define DEG2RAD(a) ((a) / (180 / M_PI)) // Convert degrees to radians
#define RAD2DEG(a) ((a) * (180 / M_PI)) // Convert radians to degrees

extern uint8_t GPS_TX;
extern uint8_t GPS_RX;

Expand Down Expand Up @@ -82,4 +85,14 @@ void getGPSData();
long detectRate(int rxPin);
long autoBaudGPS();

/**
* @brief Satellite Constellation Canvas Definition
*
*/
static const uint8_t canvasOffset = 15;
static const uint8_t canvasSize = 180;
static const uint8_t canvasCenter_X = canvasSize / 2;
static const uint8_t canvasCenter_Y = canvasSize / 2;
static const uint8_t canvasRadius = canvasCenter_X - canvasOffset;

#endif
17 changes: 14 additions & 3 deletions lib/gui/src/mainScr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ void scrollTile(lv_event_t *event)
}

deleteMapScrSprites();
deleteSatInfoSprites();
}

/**
Expand Down Expand Up @@ -190,7 +189,6 @@ void updateMainScreen(lv_timer_t *t)
break;

case SATTRACK:
constelSprite.pushSprite(150 * scale, 40 * scale);
lv_obj_send_event(satTrackTile, LV_EVENT_VALUE_CHANGED, NULL);
break;

Expand Down Expand Up @@ -276,7 +274,8 @@ void updateSatTrack(lv_event_t *event)

lv_label_set_text_fmt(altLabel, "ALT: %4dm.", gpsData.altitude);

fillSatInView();
drawSatSNR();
drawSatSky();
}

/**
Expand Down Expand Up @@ -539,6 +538,18 @@ void createMainScr()

// Satellite Tracking and info Tile
satelliteScr(satTrackTile);
#ifdef BOARD_HAS_PSRAM
#ifndef TDECK_ESP32S3
createConstCanvas(satTrackTile);
drawSatConst();
lv_obj_set_pos(constCanvas,( TFT_WIDTH / 2 ) - canvasCenter_X, 240);
#endif
#ifdef TDECK_ESP32S3
createConstCanvas(constMsg);
lv_obj_align(constCanvas,LV_ALIGN_CENTER,0,0);
drawSatConst();
#endif
#endif

// Satellite Tracking Event
lv_obj_add_event_cb(satTrackTile, updateSatTrack, LV_EVENT_VALUE_CHANGED, NULL);
Expand Down
1 change: 0 additions & 1 deletion lib/gui/src/mainScr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "globalGuiDef.h"
#include "lvglFuncs.hpp"
#include "misc/lv_color.h"
#include "satInfo.hpp"
#include "notifyBar.hpp"
#include "buttonBar.hpp"
#include "renderMaps.hpp"
Expand Down
155 changes: 0 additions & 155 deletions lib/gui/src/satInfo.cpp

This file was deleted.

39 changes: 0 additions & 39 deletions lib/gui/src/satInfo.hpp

This file was deleted.

Loading

0 comments on commit e78746a

Please sign in to comment.