Skip to content

Commit

Permalink
commentaires
Browse files Browse the repository at this point in the history
  • Loading branch information
rene-d committed Mar 7, 2020
1 parent aac4310 commit 1a6b661
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions mkerfs32.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python3
# ERFS.cpp - Embedded Read-only File System (ERFS)
# Copyright (c) 2020 René Devichi. All rights reserved.

#
# ERFS is heavily inspired by Microchip Proprietary File System (MPFS2)
#
Expand Down
11 changes: 7 additions & 4 deletions src/ERFS.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// ERFS.cpp - Embedded Read-only File System (ERFS)
// Copyright (c) 2020 René Devichi. All rights reserved.

//
// ERFS is heavily inspired by Microchip Proprietary File System (MPFS2)
//
// It is intended to provide a small read-only filesystem for ESP8266.
//
// ERFS Structure:
// [E][P][F][S]
Expand Down Expand Up @@ -64,6 +65,7 @@ struct FATRecord

#define NAME_MAX_SIZE 64

// returns the next 4-byte boundary
static inline uint32_t align32(uint32_t n)
{
if ((n & 3) == 0)
Expand Down Expand Up @@ -111,9 +113,9 @@ class ERFSImpl : public fs::FSImpl
}

private:
uint32_t start_; // address
uint32_t size_; // size in bytes
uint16_t num_files_;
uint32_t start_; // physical address in flash
uint32_t size_; // size in bytes
uint16_t num_files_; // number of files
};

class ERFSFileImpl : public fs::FileImpl
Expand Down Expand Up @@ -157,6 +159,7 @@ class ERFSDirImpl : public fs::DirImpl
explicit ERFSDirImpl(ERFSImpl *impl) : impl_(impl), index_(0)
{
memset(name_, 0, NAME_MAX_SIZE);
memset(&record_, 0, sizeof(FATRecord));
}

virtual fs::FileImplPtr openFile(fs::OpenMode openMode, fs::AccessMode accessMode) override
Expand Down
5 changes: 4 additions & 1 deletion src/cli.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// module téléinformation client
// rene-d 2020

// commandes par le port série pour la mise au point

#include "wifinfo.h"

#ifdef ENABLE_CLI
Expand All @@ -20,6 +22,7 @@
#include <PolledTimeout.h>
#include <SimpleCLI.h>

// valeurs positionnées par le linker
extern "C" uint32_t _EEPROM_start;
extern "C" uint32_t _FS_start;
extern "C" uint32_t _FS_end;
Expand Down Expand Up @@ -150,7 +153,7 @@ void cli_setup()
uint8_t buf[64];
buf[10] = 0;
size_t n = f.read(buf, sizeof(buf) - 1);
if (n != -1)
if (n != (size_t)-1)
{
buf[n] = 0;
Serial.printf_P(PSTR("read %zu, version: '%s'\n"), n, (const char *)buf);
Expand Down
2 changes: 1 addition & 1 deletion src/filesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void fs_get_json(String &response, bool restricted)
return;
}

response.reserve(512); // about 400 bytes
response.reserve(512); // JSON is about 500 bytes

response = F("{\"files\":");

Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void setup()
// en debug, on reste à 115200: on ne se branche pas au compteur
Serial.begin(115200);
#else
// sinon, RX est utilisé pour la téléinfo. TX peut toujours envoyer des diags
// sinon, RX est utilisé pour la téléinfo. TX est coupé
Serial.begin(1200, SERIAL_7E1, SERIAL_RX_ONLY);
#endif
Serial.flush();
Expand Down

0 comments on commit 1a6b661

Please sign in to comment.