mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-26 22:33:24 +00:00
Cpp-check warnings cleanup (#3014)
* cpp-check warnings cleanup * Supressions and more fixes
This commit is contained in:
parent
9f85279e74
commit
4720b2874f
@ -42,7 +42,7 @@ namespace concurrency
|
|||||||
class AccelerometerThread : public concurrency::OSThread
|
class AccelerometerThread : public concurrency::OSThread
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AccelerometerThread(ScanI2C::DeviceType type = ScanI2C::DeviceType::NONE) : OSThread("AccelerometerThread")
|
explicit AccelerometerThread(ScanI2C::DeviceType type) : OSThread("AccelerometerThread")
|
||||||
{
|
{
|
||||||
if (accelerometer_found.port == ScanI2C::I2CPort::NO_I2C) {
|
if (accelerometer_found.port == ScanI2C::I2CPort::NO_I2C) {
|
||||||
LOG_DEBUG("AccelerometerThread disabling due to no sensors found\n");
|
LOG_DEBUG("AccelerometerThread disabling due to no sensors found\n");
|
||||||
|
@ -10,7 +10,7 @@ namespace concurrency
|
|||||||
class AmbientLightingThread : public concurrency::OSThread
|
class AmbientLightingThread : public concurrency::OSThread
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AmbientLightingThread(ScanI2C::DeviceType type) : OSThread("AmbientLightingThread")
|
explicit AmbientLightingThread(ScanI2C::DeviceType type) : OSThread("AmbientLightingThread")
|
||||||
{
|
{
|
||||||
// Uncomment to test module
|
// Uncomment to test module
|
||||||
// moduleConfig.ambient_lighting.led_state = true;
|
// moduleConfig.ambient_lighting.led_state = true;
|
||||||
|
@ -402,11 +402,8 @@ bool Power::analogInit()
|
|||||||
*/
|
*/
|
||||||
bool Power::setup()
|
bool Power::setup()
|
||||||
{
|
{
|
||||||
bool found = axpChipInit();
|
bool found = axpChipInit() || analogInit();
|
||||||
|
|
||||||
if (!found) {
|
|
||||||
found = analogInit();
|
|
||||||
}
|
|
||||||
enabled = found;
|
enabled = found;
|
||||||
low_voltage_counter = 0;
|
low_voltage_counter = 0;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ class PowerFSMThread : public OSThread
|
|||||||
|
|
||||||
/// If we are in power state we force the CPU to wake every 10ms to check for serial characters (we don't yet wake
|
/// If we are in power state we force the CPU to wake every 10ms to check for serial characters (we don't yet wake
|
||||||
/// cpu for serial rx - FIXME)
|
/// cpu for serial rx - FIXME)
|
||||||
const auto state = powerFSM.getState();
|
const State *state = powerFSM.getState();
|
||||||
canSleep = (state != &statePOWER) && (state != &stateSERIAL);
|
canSleep = (state != &statePOWER) && (state != &stateSERIAL);
|
||||||
|
|
||||||
if (powerStatus->getHasUSB()) {
|
if (powerStatus->getHasUSB()) {
|
||||||
|
@ -184,7 +184,7 @@ void Channels::onConfigChanged()
|
|||||||
{
|
{
|
||||||
// Make sure the phone hasn't mucked anything up
|
// Make sure the phone hasn't mucked anything up
|
||||||
for (int i = 0; i < channelFile.channels_count; i++) {
|
for (int i = 0; i < channelFile.channels_count; i++) {
|
||||||
meshtastic_Channel &ch = fixupChannel(i);
|
const meshtastic_Channel &ch = fixupChannel(i);
|
||||||
|
|
||||||
if (ch.role == meshtastic_Channel_Role_PRIMARY)
|
if (ch.role == meshtastic_Channel_Role_PRIMARY)
|
||||||
primaryIndex = i;
|
primaryIndex = i;
|
||||||
|
@ -39,10 +39,11 @@
|
|||||||
*/
|
*/
|
||||||
char *strnstr(const char *s, const char *find, size_t slen)
|
char *strnstr(const char *s, const char *find, size_t slen)
|
||||||
{
|
{
|
||||||
char c, sc;
|
char c;
|
||||||
size_t len;
|
|
||||||
|
|
||||||
if ((c = *find++) != '\0') {
|
if ((c = *find++) != '\0') {
|
||||||
|
char sc;
|
||||||
|
size_t len;
|
||||||
|
|
||||||
len = strlen(find);
|
len = strlen(find);
|
||||||
do {
|
do {
|
||||||
do {
|
do {
|
||||||
|
@ -118,7 +118,7 @@ uint32_t NeighborInfoModule::collectNeighborInfo(meshtastic_NeighborInfo *neighb
|
|||||||
int num_neighbors = cleanUpNeighbors();
|
int num_neighbors = cleanUpNeighbors();
|
||||||
|
|
||||||
for (int i = 0; i < num_neighbors; i++) {
|
for (int i = 0; i < num_neighbors; i++) {
|
||||||
meshtastic_Neighbor *dbEntry = getNeighborByIndex(i);
|
const meshtastic_Neighbor *dbEntry = getNeighborByIndex(i);
|
||||||
if ((neighborInfo->neighbors_count < MAX_NUM_NEIGHBORS) && (dbEntry->node_id != my_node_id)) {
|
if ((neighborInfo->neighbors_count < MAX_NUM_NEIGHBORS) && (dbEntry->node_id != my_node_id)) {
|
||||||
neighborInfo->neighbors[neighborInfo->neighbors_count].node_id = dbEntry->node_id;
|
neighborInfo->neighbors[neighborInfo->neighbors_count].node_id = dbEntry->node_id;
|
||||||
neighborInfo->neighbors[neighborInfo->neighbors_count].snr = dbEntry->snr;
|
neighborInfo->neighbors[neighborInfo->neighbors_count].snr = dbEntry->snr;
|
||||||
@ -146,7 +146,7 @@ size_t NeighborInfoModule::cleanUpNeighbors()
|
|||||||
// Find neighbors to remove
|
// Find neighbors to remove
|
||||||
std::vector<int> indices_to_remove;
|
std::vector<int> indices_to_remove;
|
||||||
for (int i = 0; i < num_neighbors; i++) {
|
for (int i = 0; i < num_neighbors; i++) {
|
||||||
meshtastic_Neighbor *dbEntry = getNeighborByIndex(i);
|
const meshtastic_Neighbor *dbEntry = getNeighborByIndex(i);
|
||||||
// We will remove a neighbor if we haven't heard from them in twice the broadcast interval
|
// We will remove a neighbor if we haven't heard from them in twice the broadcast interval
|
||||||
if ((now - dbEntry->last_rx_time > dbEntry->node_broadcast_interval_secs * 2) && (dbEntry->node_id != my_node_id)) {
|
if ((now - dbEntry->last_rx_time > dbEntry->node_broadcast_interval_secs * 2) && (dbEntry->node_id != my_node_id)) {
|
||||||
indices_to_remove.push_back(i);
|
indices_to_remove.push_back(i);
|
||||||
|
@ -519,10 +519,10 @@ std::string MQTT::meshPacketToJson(meshtastic_MeshPacket *mp)
|
|||||||
// the created jsonObj is immutable after creation, so
|
// the created jsonObj is immutable after creation, so
|
||||||
// we need to do the heavy lifting before assembling it.
|
// we need to do the heavy lifting before assembling it.
|
||||||
std::string msgType;
|
std::string msgType;
|
||||||
JSONObject msgPayload;
|
|
||||||
JSONObject jsonObj;
|
JSONObject jsonObj;
|
||||||
|
|
||||||
if (mp->which_payload_variant == meshtastic_MeshPacket_decoded_tag) {
|
if (mp->which_payload_variant == meshtastic_MeshPacket_decoded_tag) {
|
||||||
|
JSONObject msgPayload;
|
||||||
switch (mp->decoded.portnum) {
|
switch (mp->decoded.portnum) {
|
||||||
case meshtastic_PortNum_TEXT_MESSAGE_APP: {
|
case meshtastic_PortNum_TEXT_MESSAGE_APP: {
|
||||||
msgType = "text";
|
msgType = "text";
|
||||||
|
@ -50,4 +50,7 @@ virtualCallInConstructor
|
|||||||
passedByValue:*/RedirectablePrint.h
|
passedByValue:*/RedirectablePrint.h
|
||||||
|
|
||||||
internalAstError:*/CrossPlatformCryptoEngine.cpp
|
internalAstError:*/CrossPlatformCryptoEngine.cpp
|
||||||
uninitMemberVar:*/AudioThread.h
|
uninitMemberVar:*/AudioThread.h
|
||||||
|
// False positive
|
||||||
|
constVariableReference:*/Channels.cpp
|
||||||
|
constParameterPointer:*/unishox2.c
|
Loading…
Reference in New Issue
Block a user