Skip to content

Comments

Feature/sd card reader#107

Merged
k3ldar merged 19 commits intomainfrom
feature/SDCardReader
Feb 8, 2026
Merged

Feature/sd card reader#107
k3ldar merged 19 commits intomainfrom
feature/SDCardReader

Conversation

@k3ldar
Copy link
Owner

@k3ldar k3ldar commented Feb 8, 2026

No description provided.

Copilot AI review requested due to automatic review settings February 8, 2026 16:04
@k3ldar k3ldar linked an issue Feb 8, 2026 that may be closed by this pull request
@k3ldar k3ldar assigned k3ldar and Copilot and unassigned k3ldar Feb 8, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces SD-card support to SmartFuseBox: periodic sensor snapshot logging to CSV, plus an SD-based configuration loader/exporter (C29/C30) and related system/status plumbing (warnings, system commands, JSON status).

Changes:

  • Add SdCardLogger for non-blocking SD logging with warning integration (missing/error).
  • Add SdCardConfigLoader to load config.txt from SD at boot and support C29 (reload) / C30 (export).
  • Extend warning propagation and system/status endpoints to expose SD state and include warning masks in heartbeats.

Reviewed changes

Copilot reviewed 38 out of 39 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
SmartFuseBox/__vm/Upload.vmps.xml Removed VisualMicro-generated upload metadata file.
SmartFuseBox/__vm/Compile.vmps.xml Removed VisualMicro-generated compile metadata file.
SmartFuseBox/SystemNetworkHandler.h Adds SD logger dependency wiring for system route.
SmartFuseBox/SystemNetworkHandler.cpp Extends system status JSON to include SD presence + log size.
SmartFuseBox/SmartFuseBoxConstants.h Adds SD SPI pin constants and light sensor analog pin.
SmartFuseBox/SmartFuseBox/SdCardConfigLoader.h Adds a second SdCardConfigLoader declaration (duplicate copy).
SmartFuseBox/SmartFuseBox/SdCardConfigLoader.cpp Adds a second SdCardConfigLoader implementation (duplicate copy).
SmartFuseBox/SmartFuseBox.vcxproj.filters Adds SD-related files but introduces duplicated filter entries.
SmartFuseBox/SmartFuseBox.vcxproj Adds SD logger/config loader sources and include paths for SPI/SdFat.
SmartFuseBox/SmartFuseBox.ino Integrates SD logger, optional SD config load, changes LINK baud, resets serial on RX.
SmartFuseBox/SensorDataRecord.h Introduces a standardized sensor record type (currently unused by logger).
SmartFuseBox/SdCardLogger.h Declares SD logger (buffering, rotation, warnings, stats).
SmartFuseBox/SdCardLogger.cpp Implements SD logger (snapshot capture, CSV writing, presence detection).
SmartFuseBox/SDCardConfigLoader.h Declares SD config loader w/ coordinated access via SdCardLogger.
SmartFuseBox/SDCardConfigLoader.cpp Implements SD config load/reload/export with logger release/reacquire.
SmartFuseBox/LightSensorHandler.h Extends constructor to accept an analog pin.
SmartFuseBox/ConfigSyncManager.cpp Switches a message from sendError to sendDebug.
SmartFuseBox/BluetoothSystemService.cpp Removes Serial prints from BLE service init/notify.
Shared/WarningType.h Adds SdCardError and SdCardMissing warning bits + strings.
Shared/WarningManager.h Adds broadcastWarningChange() declaration.
Shared/WarningManager.cpp Broadcasts warning deltas, includes local warnings in heartbeat, adds helper method.
Shared/ToneManager.cpp Removes verbose Serial debug logging.
Shared/SystemFunctions.h Adds resetSerial(Stream&) helper.
Shared/SystemDefinitions.h Adds F8/F9 system cmds and C29/C30 config cmds.
Shared/Sensors/GpsSensorHandler.h Improves GPS time sync to support partial date/time validity.
Shared/DateTimeManager.cpp Formatting-only brace/indentation adjustments.
Shared/CommandHandlers/SystemCommandHandler.h Adds SD logger wiring to system command handler (UNO R4).
Shared/CommandHandlers/SystemCommandHandler.cpp Adds F8/F9 support; changes F6 parsing behavior.
Shared/CommandHandlers/SensorCommandHandler.cpp Expands query handling and adds debug messages.
Shared/CommandHandlers/ConfigCommandHandler.h Adds SD config loader wiring (C29/C30).
Shared/CommandHandlers/ConfigCommandHandler.cpp Implements C29/C30 commands and SD loader integration.
Shared/CommandHandlers/AckCommandHandler.cpp Silences unused parameter warning.
SD_CONFIG_README.md Adds end-user documentation for SD config loader.
SD_CONFIG_IMPLEMENTATION.md Adds implementation guide (some now outdated given code changes).
Commands.md Documents new F8/F9 and C29/C30 (contains a command example typo).
BoatControlPanel/BoatControlPanel.vcxproj.filters Adjusts BaseSensor include entry to local path.
BoatControlPanel/BoatControlPanel.vcxproj Adjusts include path and BaseSensor include to local file.
BoatControlPanel/BoatControlPanel.ino Aligns LINK baud to 19200 and uses SystemFunctions::resetSerial.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to +20
#pragma once

#include <Arduino.h>
#include <SdFat.h>
#include <SerialCommandManager.h>
#include "ConfigController.h"
#include "ConfigSyncManager.h"

constexpr char SD_CONFIG_FILENAME[] = "config.txt";
constexpr uint16_t SD_CONFIG_MAX_LINE_LENGTH = 128;

/**
* @class SdCardConfigLoader
* @brief Loads configuration from SD card and applies to ConfigManager
*
* Boot sequence:
* 1. Check for SD card with config.txt
* 2. Parse and validate all commands
* 3. Compare with current EEPROM config
* 4. If different, apply changes and save to EEPROM
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two SdCardConfigLoader implementations in the repo (SmartFuseBox/SDCardConfigLoader.* and SmartFuseBox/SmartFuseBox/SdCardConfigLoader.*). Keeping both is confusing and risks future build/include mistakes; consolidate to a single source of truth and remove the unused duplicate directory/files.

Copilot uses AI. Check for mistakes.
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

Copy link
Contributor

Copilot AI commented Feb 8, 2026

@k3ldar I've opened a new pull request, #108, to work on those changes. Once the pull request is ready, I'll request review from you.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@k3ldar k3ldar merged commit 3f61609 into main Feb 8, 2026
@k3ldar k3ldar deleted the feature/SDCardReader branch February 8, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SD Card Reader

2 participants