Skip to content

Conversation

@dido18
Copy link
Contributor

@dido18 dido18 commented Oct 16, 2025

Motivation

Fix compilation failure for UnoQ when both Modulino and Arduino_LED_Matrix libraries are included.

How to reproduce

  • Modulino 0.6.0
  • arduino:zephyr 0.51.0

Example sketch that triggers the error:

#include <Modulino.h>
#include "Arduino_LED_Matrix.h"

void setup() {
  Modulino.begin();
}

void loop() {}

Error

/home/arduino/.cache/arduino/sketches/01A8778A6FDBF10D480441898938F9AD/sketch/sketch.ino.cpp.o: in function `ModulinoClass::begin(arduino::HardwareI2C&)':
/home/arduino/ArduinoApps/scratch-arduino-app/sketch/Arduino_Modulino/src/Modulino.h:46: undefined reference to `__increaseI2CPriority()'
collect2: error: ld returned 1 exit status

Root Cause

Modulino.cpp incorrectly handles the conditional logic for defining __increaseI2CPriority.
When Arduino_LED_Matrix.h is included but ARDUINO_UNOR4_WIFI is not defined (e.g., compiling for UnoQ), neither branch provides a definition for the function, resulting in an undefined reference.

Fix

Ensure that there is always at least one definition of __increaseI2CPriority. If UnoQ the void definition is added.

@per1234 per1234 added the bug Something isn't working label Oct 16, 2025
@dido18
Copy link
Contributor Author

dido18 commented Oct 16, 2025

Tested on UNOQ

#include <Modulino.h>
#include "Arduino_LED_Matrix.h"

Arduino_LED_Matrix matrix;
ModulinoButtons buttons;

uint8_t shades[104] = {
	0,	0,	0,	0,	0,	0,	0,	0,	0,	0,	0,	0,	0,	
	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,
	2,	2,	2,	2,	2,	2,	2,	2,	2,	2,	2,	2,	2,
	3,	3,	3,	3,	3,	3,	3,	3,	3,	3,	3,	3,	3,
	4,	4,	4,	4,	4,	4,	4,	4,	4,	4,	4,	4,	4,
	5,	5,	5,	5,	5,	5,	5,	5,	5,	5,	5,	5,	5,
	6,	6,	6,	6,	6,	6,	6,	6,	6,	6,	6,	6,	6,
	7,	7,	7,	7,	7,	7,	7,	7,	7,	7,	7,	7,	7,
};

void setup() {
  Modulino.begin(Wire1);
  buttons.begin();
  matrix.begin();
}

void loop() {
   if (buttons.update()) {
    if (buttons.isPressed('A')) {
       matrix.clear();
    }
     if (buttons.isPressed('B')) {
       matrix.draw(shades);
    }
  }
}

@dido18
Copy link
Contributor Author

dido18 commented Oct 16, 2025

Tested on UNO R4 with this sketch

#include "Arduino_LED_Matrix.h"   // Include the LED_Matrix library
#include "frames.h"               // Include a header file containing some custom icons
#include <Modulino.h>

ModulinoButtons buttons;
ArduinoLEDMatrix matrix;          // Create an instance of the ArduinoLEDMatrix class

void setup() {
  Serial.begin(115200);           // Initialize serial communication at a baud rate of 115200
  matrix.begin();                 // Initialize the LED matrix
  Modulino.begin();
  buttons.begin();
}

void loop() {
  if (buttons.update()) {
    if (buttons.isPressed('A')) {
       matrix.loadFrame(LEDMATRIX_HEART_BIG);
    } else if (buttons.isPressed("B")) {
      matrix.clear();
    }
  }
}

@dido18 dido18 marked this pull request as ready for review October 16, 2025 08:06
@facchinm facchinm merged commit 480e9d1 into arduino-libraries:main Oct 16, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants