mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-14 17:25:10 +00:00
fix compilation, double macros resolved
This commit is contained in:
parent
840996c755
commit
94155f170e
@ -21,7 +21,7 @@ const uint8_t bluetoothConnectedIcon[36] PROGMEM = {0xfe, 0x01, 0xff, 0x03, 0x03
|
||||
#endif
|
||||
|
||||
#if (defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ILI9342_DRIVER) || defined(ST7701_CS) || defined(ST7735_CS) || \
|
||||
defined(ST7789_CS) || defined(USE_ST7789) || defined(HX8357_CS)) && \
|
||||
defined(ST7789_CS) || defined(USE_ST7789) || defined(HX8357_CS)) && \
|
||||
!defined(DISPLAY_FORCE_SMALL_FONTS)
|
||||
const uint8_t imgQuestionL1[] PROGMEM = {0xff, 0x01, 0x01, 0x32, 0x7b, 0x49, 0x49, 0x6f, 0x26, 0x01, 0x01, 0xff};
|
||||
const uint8_t imgQuestionL2[] PROGMEM = {0x0f, 0x08, 0x08, 0x08, 0x06, 0x0f, 0x0f, 0x06, 0x08, 0x08, 0x08, 0x0f};
|
||||
|
@ -89,7 +89,7 @@ void StoreForwardModule::populatePSRAM()
|
||||
LOG_DEBUG("After PSRAM init: heap %d/%d PSRAM %d/%d", memGet.getFreeHeap(), memGet.getHeapSize(), memGet.getFreePsram(),
|
||||
memGet.getPsramSize());
|
||||
LOG_DEBUG("numberOfPackets for packetHistory - %u", numberOfPackets);
|
||||
this->storageType = StorageType::PSRAM;
|
||||
this->storageType = StorageType::ST_PSRAM;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -156,7 +156,7 @@ uint32_t StoreForwardModule::getNumAvailablePackets(NodeNum dest, uint32_t last_
|
||||
lastRequest.emplace(dest, 0);
|
||||
}
|
||||
for (uint32_t i = lastRequest[dest]; i < this->packetHistoryTotalCount; i++) {
|
||||
if (this->storageType == StorageType::PSRAM) {
|
||||
if (this->storageType == StorageType::ST_PSRAM) {
|
||||
if (this->packetHistory[i].time && (this->packetHistory[i].time > last_time)) {
|
||||
// Client is only interested in packets not from itself and only in broadcast packets or packets towards it.
|
||||
if (this->packetHistory[i].from != dest &&
|
||||
@ -164,7 +164,8 @@ uint32_t StoreForwardModule::getNumAvailablePackets(NodeNum dest, uint32_t last_
|
||||
count++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else if (this->storageType == StorageType::ST_SDCARD) {
|
||||
#if defined(HAS_SDCARD)
|
||||
auto handler = SD.open("/storeforward/" + String(i), FILE_READ);
|
||||
if (handler) {
|
||||
handler.read((uint8_t *)&this->packetHistory[0], sizeof(PacketHistoryStruct));
|
||||
@ -177,6 +178,9 @@ uint32_t StoreForwardModule::getNumAvailablePackets(NodeNum dest, uint32_t last_
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
LOG_ERROR("S&F: Unknown storage type");
|
||||
}
|
||||
}
|
||||
return count;
|
||||
@ -230,7 +234,7 @@ void StoreForwardModule::historyAdd(const meshtastic_MeshPacket &mp)
|
||||
}
|
||||
}
|
||||
|
||||
if (this->storageType == StorageType::PSRAM) {
|
||||
if (this->storageType == StorageType::ST_PSRAM) {
|
||||
this->packetHistory[this->packetHistoryTotalCount].time = getTime();
|
||||
this->packetHistory[this->packetHistoryTotalCount].to = mp.to;
|
||||
this->packetHistory[this->packetHistoryTotalCount].channel = mp.channel;
|
||||
@ -238,8 +242,9 @@ void StoreForwardModule::historyAdd(const meshtastic_MeshPacket &mp)
|
||||
this->packetHistory[this->packetHistoryTotalCount].payload_size = p.payload.size;
|
||||
memcpy(this->packetHistory[this->packetHistoryTotalCount].payload, p.payload.bytes,
|
||||
meshtastic_Constants_DATA_PAYLOAD_LEN);
|
||||
} else {
|
||||
// Save to SDCARD
|
||||
} else if (this->storageType == StorageType::ST_SDCARD) {
|
||||
// Save to SDCARD
|
||||
#if defined(HAS_SDCARD)
|
||||
this->packetHistory[0].time = getTime();
|
||||
this->packetHistory[0].to = mp.to;
|
||||
this->packetHistory[0].channel = mp.channel;
|
||||
@ -249,6 +254,9 @@ void StoreForwardModule::historyAdd(const meshtastic_MeshPacket &mp)
|
||||
auto handler = SD.open("/storeforward/" + String(this->packetHistoryTotalCount), FILE_WRITE);
|
||||
handler.write((uint8_t *)&this->packetHistory, sizeof(PacketHistoryStruct));
|
||||
handler.close();
|
||||
#endif
|
||||
} else {
|
||||
LOG_ERROR("S&F: Unknown storage type");
|
||||
}
|
||||
|
||||
this->packetHistoryTotalCount++;
|
||||
@ -283,7 +291,7 @@ bool StoreForwardModule::sendPayload(NodeNum dest, uint32_t last_time)
|
||||
meshtastic_MeshPacket *StoreForwardModule::preparePayload(NodeNum dest, uint32_t last_time, bool local)
|
||||
{
|
||||
for (uint32_t i = lastRequest[dest]; i < this->packetHistoryTotalCount; i++) {
|
||||
if (this->storageType == StorageType::PSRAM) {
|
||||
if (this->storageType == StorageType::ST_PSRAM) {
|
||||
|
||||
if (this->packetHistory[i].time && (this->packetHistory[i].time > last_time)) {
|
||||
/* Copy the messages that were received by the server in the last msAgo
|
||||
@ -327,7 +335,8 @@ meshtastic_MeshPacket *StoreForwardModule::preparePayload(NodeNum dest, uint32_t
|
||||
return p;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else if (this->storageType == StorageType::ST_SDCARD) {
|
||||
#if defined(HAS_SDCARD)
|
||||
auto handler = SD.open("/storeforward/" + String(i), FILE_READ);
|
||||
if (handler) {
|
||||
handler.read((uint8_t *)&this->packetHistory[0], sizeof(PacketHistoryStruct));
|
||||
@ -371,6 +380,9 @@ meshtastic_MeshPacket *StoreForwardModule::preparePayload(NodeNum dest, uint32_t
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
LOG_ERROR("S&F: Unknown storage type");
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
|
@ -23,7 +23,7 @@ struct PacketHistoryStruct {
|
||||
};
|
||||
|
||||
// enum for the storage type
|
||||
enum StorageType { PSRAM, SDCARD };
|
||||
enum StorageType { ST_PSRAM, ST_SDCARD };
|
||||
|
||||
class StoreForwardModule : private concurrency::OSThread, public ProtobufModule<meshtastic_StoreAndForward>
|
||||
{
|
||||
@ -90,7 +90,7 @@ class StoreForwardModule : private concurrency::OSThread, public ProtobufModule<
|
||||
void populateSDCard();
|
||||
|
||||
// Storage Type
|
||||
StorageType storageType = PSRAM;
|
||||
StorageType storageType = ST_PSRAM;
|
||||
|
||||
// S&F Defaults
|
||||
uint32_t historyReturnMax = 25; // Return maximum of 25 records by default.
|
||||
|
Loading…
Reference in New Issue
Block a user