Skip to content

Commit

Permalink
chore: implement meshtastic/firmware meshtastic#5454
Browse files Browse the repository at this point in the history
Clean up some inline functions
  • Loading branch information
todd-herbert committed Dec 3, 2024
1 parent 147b408 commit 6fc64a5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void InkHUD::NodeListApplet::render()
// use "? km" if unknown
// Todo: miles
meshtastic_NodeInfoLite *ourNode = nodeDB->getMeshNode(nodeDB->getNodeNum());
if (node && hasValidPosition(node) && hasValidPosition(ourNode)) {
if (node && nodeDB->hasValidPosition(node) && nodeDB->hasValidPosition(ourNode)) {
// Get lat and long as float
// Meshtastic stores these as integers internally
float ourLat = ourNode->position.latitude_i * 1e-7;
Expand Down
10 changes: 5 additions & 5 deletions src/graphics/niche/InkHUD/Applets/User/Map/MapApplet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ void InkHUD::MapApplet::render()
// Draw a special marker for the most recently heard node
// This node might not yet have a nodeDB entry
meshtastic_NodeInfoLite *lastHeardNode = nodeDB->getMeshNode(lastHeardNodeNum);
if (lastHeardNode && hasValidPosition(lastHeardNode))
if (lastHeardNode && nodeDB->hasValidPosition(lastHeardNode))
renderMarker(lastHeardMarker, scaleX, scaleY, padding, lastHeardNode);

// Tidy up
Expand Down Expand Up @@ -280,7 +280,7 @@ bool InkHUD::MapApplet::serviceCalculationThread()
uint32_t nodeCount = nodeDB->getNumMeshNodes();
for (uint32_t i = 0; i < nodeCount; i++) {
meshtastic_NodeInfoLite *node = nodeDB->getMeshNodeByIndex(i);
if (node && hasValidPosition(node)) {
if (node && nodeDB->hasValidPosition(node)) {
anyNodes = true;
break;
}
Expand Down Expand Up @@ -308,7 +308,7 @@ bool InkHUD::MapApplet::serviceCalculationThread()

// Fail if we don't have a position
// Todo: handle in render()
if (!ourNode || !hasValidPosition(ourNode)) {
if (!ourNode || !nodeDB->hasValidPosition(ourNode)) {
calcState = CALC_FAILED_NO_POSITION;
calcStep = STEP_RENDER;
return true; // run again, moving directly to the final step
Expand Down Expand Up @@ -336,7 +336,7 @@ bool InkHUD::MapApplet::serviceCalculationThread()
meshtastic_NodeInfoLite *node = nodeDB->getMeshNodeByIndex(nodeIndex);

// Analyze only if has a valid position (not 0,0 "null island")
if (node && hasValidPosition(node)) {
if (node && nodeDB->hasValidPosition(node)) {

// Convert from Meshtastic's internal "integer" format for position info
float latitude = node->position.latitude_i * 1e-7;
Expand Down Expand Up @@ -414,7 +414,7 @@ bool InkHUD::MapApplet::serviceCalculationThread()
meshtastic_NodeInfoLite *node = nodeDB->getMeshNodeByIndex(nodeIndex);

// Process only if node has valid position
if (node && hasValidPosition(node)) {
if (node && nodeDB->hasValidPosition(node)) {
// Convert from Meshtastic's internal "integer" format for position info
float latitude = node->position.latitude_i * 1e-7;
float longitude = node->position.longitude_i * 1e-7;
Expand Down

0 comments on commit 6fc64a5

Please sign in to comment.