Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 30, 2025

Arduino compilation failed for all three TankAlarm-112025 sketches due to namespace conflicts between arduino::Stream and mbed::Stream on the Mbed OS platform.

Root Cause

The shared library used using namespace mbed;, which brought mbed::Stream into the global namespace. Third-party libraries (Notecard, ArduinoJson) expected arduino::Stream in the global namespace, causing ambiguity:

// Before - caused ambiguous Stream reference
#include <mbed.h>
using namespace mbed;  // Brings mbed::Stream into global
#include <Notecard.h>  // Expects arduino::Stream in global

Additionally, sketches redundantly included libraries already pulled in by the shared header, and the Client sketch redefined constants already declared in TankAlarm_Common.h.

Changes

TankAlarm-112025-Common/src/TankAlarm_Platform.h

  • Replaced using namespace mbed; with specific type declarations
  • Added using arduino::Stream; and using arduino::Print; for library compatibility
// After - explicit namespace resolution
#include <mbed.h>
using mbed::LittleFileSystem;
using mbed::BlockDevice;
using mbed::Watchdog;
using arduino::Stream;
using arduino::Print;

All three sketches

  • Removed duplicate #include <Notecard.h> and #include <ArduinoJson.h>
  • Removed conflicting NOTECARD_I2C_ADDRESS and NOTECARD_I2C_FREQUENCY constant definitions from Client sketch

All sketches now compile successfully for Arduino Opta.

Original prompt

This section details on the original issue you should resolve

<issue_title>Arduino Compilation Error in Multiple Sketches (112025) (2025-12-30)</issue_title>
<issue_description>## Arduino Compilation Failed - TankAlarm 112025

The Arduino code compilation failed for the TankAlarm-112025 (Blues Opta) projects.

Workflow Run: https://github.com/SenaxInc/ArduinoSMSTankAlarm/actions/runs/20603351395
Commit: 90bb6c2
Branch: 164/merge

Details

TankAlarm-112025 (Arduino Opta)

  • Client Sketch: TankAlarm-112025-Client-BluesOpta/TankAlarm-112025-Client-BluesOpta.ino ❌
  • Server Sketch: TankAlarm-112025-Server-BluesOpta/TankAlarm-112025-Server-BluesOpta.ino ❌
  • Viewer Sketch: TankAlarm-112025-Viewer-BluesOpta/TankAlarm-112025-Viewer-BluesOpta.ino ❌

Board:

  • Arduino Opta (arduino:mbed_opta:opta)

Triggered by: pull_request

Next Steps

  1. Review the workflow logs for detailed error messages
  2. Fix compilation errors in the Arduino code
  3. Re-run the workflow to verify the fix

/cc @copilot</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits December 30, 2025 19:53
- Remove duplicate Notecard.h and ArduinoJson.h includes from sketches
- Remove conflicting NOTECARD_I2C_ADDRESS/FREQUENCY constant definitions
- Resolve Stream class namespace conflict between arduino:: and mbed::
- Replace 'using namespace mbed;' with specific type declarations
- Add using declarations for arduino::Stream, arduino::Print, mbed::LittleFileSystem, mbed::BlockDevice, and mbed::Watchdog
- All three sketches (Client, Server, Viewer) now compile successfully

Co-authored-by: dorkmo <1923070+dorkmo@users.noreply.github.com>
Co-authored-by: dorkmo <1923070+dorkmo@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Arduino compilation error for TankAlarm-112025 Fix namespace conflicts in TankAlarm 112025 Arduino sketches Dec 30, 2025
Copilot AI requested a review from dorkmo December 30, 2025 19:56
@dorkmo dorkmo marked this pull request as ready for review December 30, 2025 20:02
Copilot AI review requested due to automatic review settings December 30, 2025 20:02
@github-actions
Copy link
Contributor

🖼️ Website Preview

Screenshots have been generated for the web pages modified in this PR.

Note: Download the website-screenshots artifact to view the full-resolution images.

112025 Server

Page Screenshot
Calibration ✅ Generated
Client Console Pin Setup ✅ Generated
Client Console ✅ Generated
Config Generator ✅ Generated
Contacts ✅ Generated
Dashboard ✅ Generated
Historical ✅ Generated
Serial Monitor ✅ Generated
Server Settings ✅ Generated

112025 Viewer

Page Screenshot
Dashboard ✅ Generated

092025 Server

Page Screenshot
404 ✅ Generated
Calibration ✅ Generated
Dashboard ✅ Generated
Email Management ✅ Generated
Tank Management ✅ Generated

Generated by GitHub Actions on 2025-12-30T20:03:34.830Z

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 resolves namespace conflicts that prevented compilation of TankAlarm-112025 Arduino sketches on the Mbed OS platform. The root cause was using namespace mbed; bringing mbed::Stream into the global namespace, which conflicted with arduino::Stream expected by third-party libraries.

  • Replaced blanket using namespace mbed; with specific type declarations
  • Added explicit using arduino::Stream; and using arduino::Print; for library compatibility
  • Removed redundant include directives and constant definitions across all three sketches

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

File Description
TankAlarm-112025-Common/src/TankAlarm_Platform.h Replaced namespace import with specific type declarations to resolve Stream conflicts
TankAlarm-112025-Client-BluesOpta/TankAlarm-112025-Client-BluesOpta.ino Removed duplicate includes and constant definitions already in TankAlarm_Common.h
TankAlarm-112025-Server-BluesOpta/TankAlarm-112025-Server-BluesOpta.ino Removed duplicate include directive
TankAlarm-112025-Viewer-BluesOpta/TankAlarm-112025-Viewer-BluesOpta.ino Removed duplicate include directive

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

@dorkmo dorkmo merged commit ca95bb5 into master Dec 30, 2025
6 of 7 checks passed
@dorkmo dorkmo deleted the copilot/fix-arduino-compilation-error-another-one branch December 30, 2025 20:20
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.

Arduino Compilation Error in Multiple Sketches (112025) (2025-12-30)

2 participants