Refactor i2cScan.h To Handle 2 Bus (#2337)

* Break i2cScan out into a set of classes for scanning i2c

* refactor i2cscan addresses to be structs that allow addressing by port + address

* build whoopsies

* trunk fmt

* trunk fmt

* lost some build fixes from the merge

* more cleaning for build safety, RTC behavior
This commit is contained in:
A. Rager
2023-03-08 19:13:46 -08:00
committed by GitHub
parent 9150c2e568
commit e6d69e2b67
20 changed files with 739 additions and 315 deletions

View File

@@ -5,8 +5,11 @@
#include "MeshService.h"
#include "NodeDB.h"
#include "PowerFSM.h" // neede for button bypass
#include "detect/ScanI2C.h"
#include "mesh/generated/meshtastic/cannedmessages.pb.h"
#include "main.h" // for cardkb_found
#ifdef OLED_RU
#include "graphics/fonts/OLEDDisplayFontsRU.h"
#endif
@@ -43,7 +46,7 @@
// Remove Canned message screen if no action is taken for some milliseconds
#define INACTIVATE_AFTER_MS 20000
extern uint8_t cardkb_found;
extern ScanI2C::DeviceAddress cardkb_found;
static const char *cannedMessagesConfigFile = "/prefs/cannedConf.proto";
@@ -56,7 +59,7 @@ CannedMessageModule::CannedMessageModule()
{
if (moduleConfig.canned_message.enabled) {
this->loadProtoForModule();
if ((this->splitConfiguredMessages() <= 0) && (cardkb_found != CARDKB_ADDR)) {
if ((this->splitConfiguredMessages() <= 0) && (cardkb_found.address != CARDKB_ADDR)) {
LOG_INFO("CannedMessageModule: No messages are configured. Module is disabled\n");
this->runState = CANNED_MESSAGE_RUN_STATE_DISABLED;
disable();