mx.transform(MD_MAX72XX::TRC); Transform Command Giving Compilation Error

Hi,

I have a set of Vertically Mounted MX_7219 Matracies and want to Transform the Text by 90 Deg so that it reads correctly.

As a test I am using the supplied example in the MX_72XX Library and adding the "mx.transform(MD_MAX72XX::TRC);" command to Rotate the Text Clockwise by 90 Deg, but getting an "exit status 1 Error compiling for board Arduino Uno." when using "TRC",

I don't seem to get any Errors using any of the other Transform commands, such as "TFUD" or "TINV".

Has anyone else had an issue with TRC or am I doing something incorrect in calling it.

Regards,

Fimez

Sorry,

Forgot to detail I am using the MD_MZ72XX_PrintText Example as a base from the Library Examples.

Thanks.

Please provide all the error message. What you quoted is at the end of the error list but the most relevant are usually at the start of the compiler error output.

Also you may want to read Parola A to Z – Vertical Displays – Arduino++

Marco,

Yes sorry, "Error Compiling" doesn't give anyone much to go on, I have attached the complete error messages a .

I have actually created a "Rotated" font file after hitting issues with the TRC command, but I was hoping to use it with your Standard MD_MX72XX Library as the rest of my Sketch is written using that and not sure I have enough knowledge yet to translate my MD_MX72XX Sketch to Parola.

I use the word "Standard" as apposed to basic as there is absolutely nothing Basic about your Libraries, they are so comprehensive, to say the least.

Thanks again for you assistance.

Regards,

Fimez.

TRC Compilation Error Message.txt (44.4 KB)

Marco,

I have looked at the Parola_Scrolling_Vertically which you mentioned and modified your Font Definition file , with Some modified characters to meet my requirements with a view to converting my existing project Sketch from using the MD_MX72xx Library to using the MD_Parola Library.

I am finding however that a lot of the MD_MX72xx "Members" do not have equivalent "Members" in the MD_Parola library, which is making the conversion of my sketch very difficult.

I would like to use the MD_Parola library with its advance functions but my existing sketch is very relient on the MD_MX72xx Library so don't want to, or have the time to re-write the whole sketch from scratch to use the MD_Parola Libary.

My sketch uses the setColumn function as the main function for the complete sketch but I can't find an equivalent function with MD_Parola.

Any suggestions would gratefully received.

Regards,

Fimez.

You need to describe what you are trying to do. If you are just displaying text, then you can forget using MD_MAX72xx directly and just use Parola it will simplify things for you. Otherwise it will depend on what you are doing.

OMG for your error file. No wonder you can't work out what is going on. Please turn off the details commands about what the compiler is doing and just use the default compiler output (change it in Preferences). That setting will mean you only see the things that really cause a problem rather than every command the IDE uses to compile the program (which is, frankly, mostly not interesting and just clutters up the output unless you are debugging what the IDE is doing).

The error you are getting is in the linker (NOT the compiler)

collect2.exe: error: ld returned 1 exit status

on code that works otherwise. I have no suggestions for why that is happening.

Marco,

Thanks as always for your response, I will look at the Compiler settings tomorrow and turn them down as you suggest.

As for what I am trying to do I will try and summarise.

  1. From previous assistance yourself and Grumpy_Mike gave me some great help on my project, which has Three Vertical
    Strips of MAX7219 Matracies, with each strip containing 16 Modules i.e. 4 Lots of 4 Matracies.

  2. I have created Three MD_Max72xx instances to control each of the three strips, using common Clk and Din pins but with
    separate CS Pins.

  3. Each Vertical strip is controlled by a Potentiometer to produce a vertical "Bar Graph" based on the potentiomer setting, lighting up a Column of Leds as it is adjusted (As it is mounted vertically these are seen as Rows between 1 and 128, i.e.16 X 8 )

  4. All of the above works fine and as expected, now the problem bit.

The project forms part of a game, where players have to adjust the three levels independently to three separate pre-defined levels which they have to identify from other clues and once all set correctly the game is complete.

At that point I am trying to Blank out the Bar Graph of the middle strip and replace it with a Four Digit Code made up of Letters and Numbers, but because the strips are vertical I need to rotate the font or at least the characters I propose to use for the revealed code.

These ideally would scroll up from the bottom to say matrix 11 for the first character of the code, second character at Matrix 9, third at Matrix 7 and fourth at Matrix 5, although the spacing apart is not critical.

I hope that explains more what I am trying to achieve without too much detail.

As the Bargraph part of the game is written extensively using MD_MAX72xx library, I was trying to avoid using your MD_Parola library even though it is more extensive as it would mean re-writing my whole sketch.

Regards,

Fimez.

P.S. Please can you let me know how I can contribute to your ongoing efforts as I realise how much work must go into building these amazing libraries.

I think a simpler design would be to use Parola in the following manner:

  1. Define ONE chain of modules with ONE connection to the Arduino.
  2. Define 3 separate zones for the different messages that you want to print. Each zone will behave like a separate display.
  3. If you want to display separate graphics (bar chart) in each zone this is straightforward. You can access the MD_MAX72xx object from the Parola library (there is a function call to get a pointer to this) and all the MD_MAX72xx functions are available.
  4. There may already be a vertical font definition in the MD_MAX72xx fonts folder.

I guess this is up to you. I often find that code needs to be rewritten a number of times before it is 'correct' and works well. Just persevering down a path because that is how you started is often not the productive.

There are a lot of examples for all the elements I discussed above. You should also read the documentation and check out the "Parola A to Z" articles from my blog.

Contributions can be made via Paypal using my email address. Instructions for this are in the documentation, the library README file and also on my blog post site ("Making a contribution").

Marco,

Thanks again for your reply and I fully agree that using Zones would be the best way forward and I intend to adopt the Parola Library and the zones technique in future projects as I can see it would be a lot more versatile.

Unfortunately at this point it would take a lot of Hardware and wiring changes, to re-arrange everything into One big String of Matracies with one connection to the Arduino.

For this project which now has very tight time constraints, I have simplified the design somewhat and added a separate set of 4 MAX7219 Modules, as a separate display for the secret code that is to be displayed when the game is solved.

I have made a lot of progress with the project now that I am not trying to rotate any of the text or use the same displays for the secret code as I am using for the Bar-graphs.

The only issue i have now, as you can see from the attached photographs is that when the game is solved, I can't seem to change the text on the Code Display (Lines 103 and 104) from "? ? ? ?" to the secret code "6 C 3 A".

I borrowed some code from your MD_MAX72xx_Print_Text Example, hope that was O.K. and configured the MD_MAX72xx Instances as follows.

// Define the number of devices we have in the strips and Code display and the hardware interface
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES_BARGRAPHS  16
#define MAX_DEVICES_CODE  4

#define CLK_PIN   13  // or SCK
#define DATA_PIN  11   // or MOSI
#define CS_PIN    10  // or SS1
#define CS_PIN1    9   // or SS2
#define CS_PIN2    8   // or SS3
#define CS_PIN3    7   // or SS4

// SPI hardware interface
MD_MAX72XX mx0 = MD_MAX72XX(HARDWARE_TYPE, CS_PIN, MAX_DEVICES_BARGRAPHS); //Bargraph 1
MD_MAX72XX mx1 = MD_MAX72XX(HARDWARE_TYPE, CS_PIN1, MAX_DEVICES_BARGRAPHS); //Bargraph 2
MD_MAX72XX mx2 = MD_MAX72XX(HARDWARE_TYPE, CS_PIN2, MAX_DEVICES_BARGRAPHS); //Bargraph 3
MD_MAX72XX mx3 = MD_MAX72XX(HARDWARE_TYPE, CS_PIN3, MAX_DEVICES_CODE); // Used For Secret Code
MD_MAX72XX mx[] = {mx0, mx1, mx2, mx3};

I am using the code below

/**
   Called when the puzzle is solved
*/void onSolve() {
#ifdef DEBUG
  Serial.println("Puzzle has just been solved!");
#endif
    
  //Set the Background Neopixle LEDS to Solid Green as Puzzle Has Been Solved
  // use a loop to fill all Background Neopixel LEDS GREEN
  for (int i = 0; i < numLedsBack; i++) {
    // Set the i'th led to green
    backleds[i] = CRGB(0, 255, 0);
    FastLED.show();

    message[BUF_SIZE] = "6 C 3 A";
    printText(0, MAX_DEVICES_CODE - 1, message);

    puzzleState = Solved;
  }
}

to change the message but it doesn't seem to overwrite the original message "? ? ? ?" which is initially set in the void setup() section of the sketch.

I tried using

char  message[BUF_SIZE] = "6 C 3 A
printText(0, MAX_DEVICES_CODE - 1, message);"

but this just screws ALL of the displays up ?

When the puzzle becomes un-solved the Code Display should return to "! ! ! !"

/**
   Called when the puzzle (which previously had been solved) becomes unsolved
*/
void onUnsolve() {
#ifdef DEBUG
  Serial.println("Puzzle has just become unsolved!");
#endif

  //Set the Background Neopixle LEDS to Solid Red as Puzzle Has Been Un-Solved
  for (int i = 0; i < numLedsBack; i++) {
    // Set the i'th led to red
    backleds[i] = CRGB(255, 0, 0);
    // Show the leds
    FastLED.show();
  }

  message[BUF_SIZE] = "! ! ! !";
  printText(0, 4 - 1, message);

  puzzleState = Running;
}

I have attached the full code in the hope you can point me in the right direction to why the "new message" isn't being sent to the Code display.

Regards,

Fimez.

short_detective.h (2.72 KB)

Compendium_Valves_With_Secret_Code_Display.ino (9.44 KB)

Thischar message[BUF_SIZE] = "? ? ? ?"; declares a string and initialises its contents.

This message[BUF_SIZE] = "6 C 3 A"; sets the BUF_SIZE element of the message array (which is just outside of the array boundary) to the address of the string "6 C 3 A" AND it should be producing a compiler warning about incompatible types, at the very least.

To copy the data into an existing c string variable you need to use the strcat() function.

EDIT: this should be the strcpy() function.

Also, as a matter of form, once you have arrays of anything you should consider using a loop

For example

#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)/(a)[0]))

for (uint8_t i=0; i < ARRAY_SIZE(mx); i++)
{
  mx[i].begin();
  mx[i].clear();
  mx[i].control(MD_MAX72XX::INTENSITY, 1);
}

is the same as all the code you have in your setup(), is more compact and is far more maintainable if you want to change the number of matrices in mx[] at any point.

Marco,

Thanks for the advice on using loops to modify my arrays, it does make more sense and makes the code easier to read.

I have been looking at strcat() but from what I have read, this concatenates strings i.e. adds my secret code string to the unSolved sting giving "? ? ? ? 6 C 3 A" I would just like to replace "? ? ? ?" with "6 C 3 A".

I have tried the replace function but just can't seem to make sense of it, as I believe I am misunderstanding the differences between char and string at this point and going around in circles.

If either yourself or another member could advise me how to simply replace one of my messages with another one, it would be much appreciated as I am stumped at the moment.

Regards,

Fimez

Oops, sorry. I should have written strcpy(). There are a whole lot of str*() functions that you should know if you want to use c strings, they are usually found in the header file string.h.

Apologies for the confusion.

Marco,

Yes I did wonder LOL, I have done a lot of digging and reading today and actually came up with quite a simple solution.

I defined the following first ...

// Display strings for Solved and UnSolved Puzzle Conditions
char str1[] = "? ? ? ?";
char str2[] = "6 C 3 A";

Then called your printText example function and passed the relevant str(x) to it to print the required message on the display.

So when the Puzzle is solved ....

printText(0, MAX_DEVICES_CODE - 1, str2);

And when the puzzle is unsolved....

printText(0, MAX_DEVICES_CODE - 1, str1);

Using this technique, I don't seem to need to declare the Buffer Size ?

Not sure if the way I have done it is correct, but it does work and achieves the results I was looking for, so thanks for all the pointers.

I am now looking into how I can use my own Font file, so digging through your documentation, but there is a lot of it as you are so detailed in your documentation.

I have used the Font Builder to modify the fonts characters I require for the puzzle, so just need to know now how to get my sketch to use my font file instead of the default one.

Regards,

Fimez

Marco,

I came across a previous forum question where you explain that the Parola fonts can be changed on the fly, but can you tell me if this can only be done with the Parola library or can it also be done with the your MD_MAX72xx Library ?

Regards,

Fimez

Using this technique, I don't seem to need to declare the Buffer Size ?

It is automatically allocated by the compiler, but you are limited to the size of the string declared or smaller. In this case it should probably be ok.

but can you tell me if this can only be done with the Parola library or can it also be done with the your MD_MAX72xx Library

setFont()
There is a section in the library documentation called "Methods for Font and characters."

Marco,

Yes I came across tht but struggling to understand how you set the pointer to the user font file ?

Well it pretty much works just like in Parola. The font definition is just an array of bytes. You pass the pointer to the array (ie, the array name). This replaces the std font with the new font.

Sorry Marco, I think I am being particularly stupid here, but where is the array name defined ?

In my font header file the first line is

MD_MAX72XX::fontType_t _fontname[] PROGMEM = {

Do I need to change _font name and if so to what ?

My my font header file is called Compendium_Valves_Modified_Font.h which I have #included in the sketch.

In your Parola Fonts example, you set

MD_MAX72XX::fontType_t *pFont;

And then set ...

P.setFont(M[curM].pFont);

But I can't see how to set these paramters in my MD_MAX72xx sketch , sorry.

MD_MAX72XX::fontType_t _fontname[] PROGMEM = {

'_fontname' is the name of the font (array). This is no different from you calling your array str[]. The rest of the line is part of the type declaration and you should follow the same template in your header file.

Assuming you called yours 'Compendium_Valves_Modified_Font' instead of '_fontname', then in your setup() you callmx[?].setFont(Compendium_Valves_Modified_Font) where ? is whichever mx[] this applies to. If it applies to all, then put it in the initilization loop. Your font will be used from then on. To go back to using the default font use mx[?].setFont(nullptr)