Clean up some inline functions (#5454)

This commit is contained in:
Ben Meadors
2024-11-26 14:00:10 -06:00
committed by GitHub
parent fe86c40145
commit 474f9b5bfb
10 changed files with 48 additions and 43 deletions

View File

@@ -271,7 +271,7 @@ bool MeshService::trySendPosition(NodeNum dest, bool wantReplies)
assert(node);
if (hasValidPosition(node)) {
if (nodeDB->hasValidPosition(node)) {
#if HAS_GPS && !MESHTASTIC_EXCLUDE_GPS
if (positionModule) {
LOG_INFO("Send position ping to 0x%x, wantReplies=%d, channel=%d", dest, wantReplies, node->channel);

View File

@@ -1387,6 +1387,13 @@ meshtastic_NodeInfoLite *NodeDB::getOrCreateMeshNode(NodeNum n)
return lite;
}
/// Sometimes we will have Position objects that only have a time, so check for
/// valid lat/lon
bool NodeDB::hasValidPosition(const meshtastic_NodeInfoLite *n)
{
return n->has_position && (n->position.latitude_i != 0 || n->position.longitude_i != 0);
}
/// Record an error that should be reported via analytics
void recordCriticalError(meshtastic_CriticalErrorCode code, uint32_t address, const char *filename)
{

View File

@@ -165,6 +165,8 @@ class NodeDB
localPosition = position;
}
bool hasValidPosition(const meshtastic_NodeInfoLite *n);
private:
uint32_t lastNodeDbSave = 0; // when we last saved our db to flash
/// Find a node in our DB, create an empty NodeInfoLite if missing
@@ -217,13 +219,6 @@ extern NodeDB *nodeDB;
prefs.is_power_saving = True
*/
/// Sometimes we will have Position objects that only have a time, so check for
/// valid lat/lon
static inline bool hasValidPosition(const meshtastic_NodeInfoLite *n)
{
return n->has_position && (n->position.latitude_i != 0 || n->position.longitude_i != 0);
}
/** The current change # for radio settings. Starts at 0 on boot and any time the radio settings
* might have changed is incremented. Allows others to detect they might now be on a new channel.
*/

View File

@@ -10,7 +10,7 @@
#include "aes-ccm.h"
#if !MESHTASTIC_EXCLUDE_PKI
static inline void WPA_PUT_BE16(uint8_t *a, uint16_t val)
static void WPA_PUT_BE16(uint8_t *a, uint16_t val)
{
a[0] = val >> 8;
a[1] = val & 0xff;