Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 6 additions & 20 deletions MIDAS/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ board = esp32-s3-devkitc-1
framework = arduino
monitor_speed = 115200
extra_scripts =
pre:extra_script.py
pre:log_enc.py
pre:tools/extra_script.py
pre:tools/log_enc.py
build_flags =
-DARDUINO_USB_CDC_ON_BOOT=1
-DCONFIG_DISABLE_HAL_LOCKS=1
Expand All @@ -37,7 +37,7 @@ platform = espressif32@6.7.0
board = adafruit_feather_esp32s3
framework = arduino
extra_scripts =
pre:extra_script.py
pre:tools/extra_script.py
build_flags =
-DARDUINO_USB_CDC_ON_BOOT=1
-DHILSIM=1
Expand All @@ -52,7 +52,7 @@ platform = espressif32@6.7.0
board = adafruit_feather_esp32s3
framework = arduino
extra_scripts =
pre:extra_script.py
pre:tools/extra_script.py
build_flags =
-DARDUINO_USB_CDC_ON_BOOT=1
-DHILSIM=1
Expand All @@ -62,25 +62,11 @@ build_unflags =
-std=gnu++11
lib_deps = sparkfun/SparkFun MMC5983MA Magnetometer Arduino Library@^1.1.4

[env:logdecoder]
platform = native
build_type = debug
extra_scripts =
pre:extra_script.py
pre:log_enc.py
build_flags =
-g3
-std=gnu++2a
build_src_filter = +<log_decode/main.cpp> -<silsim/> -<hardware/> -<hilsim/>
build_unflags =
-std=gnu++11
lib_deps = sparkfun/SparkFun MMC5983MA Magnetometer Arduino Library@^1.1.4

[env:mcu_silsim_sustainer]
platform = native
build_type = debug
extra_scripts =
pre:extra_script.py
pre:tools/extra_script.py
build_flags =
-DSILSIM
-g3
Expand Down Expand Up @@ -112,7 +98,7 @@ extra_scripts = pre:test/fsm_test/srcinc.py
platform = native
build_type = debug
extra_scripts =
pre:extra_script.py
pre:tools/extra_script.py
build_flags =
-DSILSIM
-g3
Expand Down
8 changes: 0 additions & 8 deletions MIDAS/src/log_decode/main.cpp

This file was deleted.

41 changes: 36 additions & 5 deletions MIDAS/src/midas_shell_commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,18 @@ MCommandExecutionResult cmd_lfd(const MShellContext& ctx) {
// <meta file content>
// <bin file content>

if (ctx.argc != 2) { return MCommandExecutionResult::ERR_INVAL_ARGC; }
if (ctx.argc != 2 && ctx.argc != 3) { }
bool stop_after_header_print = false;
if(ctx.argc == 3) {
if(!strcmp(ctx.argv[2], "--head")) {
stop_after_header_print = true;
} else {
return MCommandExecutionResult::ERR_INVAL_ARGUMENT;
}
} else if (ctx.argc != 2) {
return MCommandExecutionResult::ERR_INVAL_ARGC;
}


String bin_path = "/" + String(ctx.argv[1]) + ".bin";
String meta_path = "/" + String(ctx.argv[1]) + ".meta";
Expand All @@ -590,15 +601,35 @@ MCommandExecutionResult cmd_lfd(const MShellContext& ctx) {
Serial.println("Failed to open .meta file!");
return MCommandExecutionResult::ERR_FS_FAIL_OPEN;
}

size_t size_ptr = LOG_FMT_VERSION; // We write multiple uint32_ts, so for serial.write to print it properly we need to store it

// Start writing header
Serial.write("LAUNCH "); Serial.write(LOG_FMT_VERSION); Serial.write('\n');
Serial.write("LAUNCH "); Serial.write((uint8_t*)&size_ptr, sizeof(size_t)); Serial.write('\n');

// File name
Serial.write("FILE "); Serial.write(ctx.argv[1]); Serial.write('\n');
Serial.write("CHECKSUM "); Serial.write(LOG_CHECKSUM); Serial.write(" "); Serial.write(EEPROM_CHECKSUM); Serial.write('\n');
Serial.write("META "); Serial.write(meta_file.size()); Serial.write('\n');
Serial.write("BIN "); Serial.write(bin_file.size()); Serial.write('\n');

// Log checksum
size_ptr = LOG_CHECKSUM;
Serial.write("CHECKSUM "); Serial.write((uint8_t*)&size_ptr, sizeof(size_t)); Serial.write(" ");

// EEPROM checksum
size_ptr = EEPROM_CHECKSUM;
Serial.write((uint8_t*)&size_ptr, sizeof(size_t)); Serial.write('\n');

// Meta file size
size_ptr = meta_file.size();
Serial.write("META "); Serial.write((uint8_t*)&size_ptr, sizeof(size_t)); Serial.write('\n');

// Binary file size
size_ptr = bin_file.size();
Serial.write("BIN "); Serial.write((uint8_t*)&size_ptr, sizeof(size_t)); Serial.write('\n');

Serial.flush();

if(stop_after_header_print) { return MCommandExecutionResult::OK; }

// Then dump meta and bin files
while(meta_file.available()) {
Serial.write(meta_file.read());
Expand Down
File renamed without changes.
Loading
Loading