mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-26 01:52:48 +00:00
Merge pull request #1496 from benner/fix/NodeDB_without_FSCom
Compile when FSCom is not defined (NodeDB.cpp)
This commit is contained in:
commit
beb8bc9e72
@ -308,12 +308,12 @@ static const char *channelfile = "/prefs/channels.proto";
|
|||||||
/** Load a protobuf from a file, return true for success */
|
/** Load a protobuf from a file, return true for success */
|
||||||
bool loadProto(const char *filename, size_t protoSize, size_t objSize, const pb_msgdesc_t *fields, void *dest_struct)
|
bool loadProto(const char *filename, size_t protoSize, size_t objSize, const pb_msgdesc_t *fields, void *dest_struct)
|
||||||
{
|
{
|
||||||
|
bool okay = false;
|
||||||
#ifdef FSCom
|
#ifdef FSCom
|
||||||
// static DeviceState scratch; We no longer read into a tempbuf because this structure is 15KB of valuable RAM
|
// static DeviceState scratch; We no longer read into a tempbuf because this structure is 15KB of valuable RAM
|
||||||
|
|
||||||
auto f = FSCom.open(filename);
|
auto f = FSCom.open(filename);
|
||||||
|
|
||||||
bool okay = false;
|
|
||||||
if (f) {
|
if (f) {
|
||||||
DEBUG_MSG("Loading %s\n", filename);
|
DEBUG_MSG("Loading %s\n", filename);
|
||||||
pb_istream_t stream = {&readcb, &f, protoSize};
|
pb_istream_t stream = {&readcb, &f, protoSize};
|
||||||
@ -367,12 +367,12 @@ void NodeDB::loadFromDisk()
|
|||||||
/** Save a protobuf from a file, return true for success */
|
/** Save a protobuf from a file, return true for success */
|
||||||
bool saveProto(const char *filename, size_t protoSize, size_t objSize, const pb_msgdesc_t *fields, const void *dest_struct)
|
bool saveProto(const char *filename, size_t protoSize, size_t objSize, const pb_msgdesc_t *fields, const void *dest_struct)
|
||||||
{
|
{
|
||||||
|
bool okay = false;
|
||||||
#ifdef FSCom
|
#ifdef FSCom
|
||||||
// static DeviceState scratch; We no longer read into a tempbuf because this structure is 15KB of valuable RAM
|
// static DeviceState scratch; We no longer read into a tempbuf because this structure is 15KB of valuable RAM
|
||||||
String filenameTmp = filename;
|
String filenameTmp = filename;
|
||||||
filenameTmp += ".tmp";
|
filenameTmp += ".tmp";
|
||||||
auto f = FSCom.open(filenameTmp.c_str(), FILE_O_WRITE);
|
auto f = FSCom.open(filenameTmp.c_str(), FILE_O_WRITE);
|
||||||
bool okay = false;
|
|
||||||
if (f) {
|
if (f) {
|
||||||
DEBUG_MSG("Saving %s\n", filename);
|
DEBUG_MSG("Saving %s\n", filename);
|
||||||
pb_ostream_t stream = {&writecb, &f, protoSize};
|
pb_ostream_t stream = {&writecb, &f, protoSize};
|
||||||
|
Loading…
Reference in New Issue
Block a user