Using bitmaps on version 2

I’ve found that if I have a bitmap , after verifying the bitmap changes to have one element per line . I’m on my phone here , think I have version 2.3

ie
Ox00,Ox00,0x00,0x00

Becomes

0x00,
0x00,
0x00,
0x00,

We are going to need a better example of the problem. Verifying the sketch should not change its layout but Auto formatting certainly could

When you can I suggest that you post a small but complete sketch that illustrates the problem

Are you sure that you did not do an auto-format?

To prevent the auto-formatter from touching a piece of code you can use the // clang-format off and // clang-format on

some code
// clang-format off
your bitmap here will not be touched
// clang-format on
some more code

There does not seem to be a way to do it with a configuration.

It looks like the first two start with alpha O

Only in the "all in a line" version

I am awaiting the real example with bated breath

Was probably that , does not happen with earlier ‘1’ versions .

Auto formatting is controlled differently in the 2 versions of the IDE

I would still like to see an example of a bitmap that is affected by Auto format in 2.x. Presumably you are declaring it as an array

Hi @hammy. This happens due to the trailing comma. For example, this code:

int foo[] = {
  1, 2, 3,
  4, 5, 6,
};

becomes this after an auto format:

int foo[] = {
  1,
  2,
  3,
  4,
  5,
  6,
};

but if you remove that trailing comma:

int foo[] = {
  1, 2, 3,
  4, 5, 6
};

then auto format leaves it as it was.

@ptillisch Perefct thanks for that reply - that sorts it

1 Like

For thoses wanting real example.....both same bitmap after autoformat (with trailing ',')

example v2.3:

type or paste code here

//The tank pictures:

static const uint8_t PROGMEM new64tankempty[] = {
  0x00,
  0x00,
  0x00,
  0x00,
  0x00,
  0x00,
  0x00,
  0x00,
  0x00,
  0x00,
  0x00,
  0x00,
  0x00,
  0x00,
  0x00,
  0x00,
  0x00,
  0x00,
  0x00,
  0x00,
  0x00,
//[and so on]

version 1.8

//The tank pictures:

static const uint8_t PROGMEM  new64tankempty [] = {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xFF, 0xFE, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0x80, 0x00, 0x00, 0x00,
  0x00, 0x01, 0xF0, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
  0x00, 0x0C, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
  0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
  0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
  0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
  0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
  0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
  0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
  0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x08, 0x04, 0x01, 0x00, 0x80, 0x00, 0x00,
  0x00, 0x08, 0x0E, 0x03, 0x80, 0x80, 0x00, 0x00, 0x00, 0x08, 0x0E, 0x03, 0x80, 0x80, 0x00, 0x00,
  0x00, 0x08, 0x0E, 0x03, 0x80, 0x80, 0x00, 0x00, 0x00, 0x08, 0x04, 0x01, 0x00, 0x80, 0x00, 0x00,
  0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
  0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x08, 0x00, 0xFC, 0x00, 0x80, 0x00, 0x00,
  0x00, 0x08, 0x01, 0x03, 0x00, 0x80, 0x00, 0x00, 0x00, 0x08, 0x06, 0x01, 0x80, 0x80, 0x00, 0x00,
  0x00, 0x08, 0x06, 0x01, 0x80, 0x80, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
  0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
  0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
  0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
  0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
  0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00,
  0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00,
  0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00,
  0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00,
  0x00, 0x08, 0x00, 0x00, 0x00, 0xFF, 0x80, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
  0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
  0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0x80, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};

Thank you

It seems that you have an explanation. Your initial example was misleading because the values in the horizontal list were not the same as the ones in the vertical list, hence the request to see a real example

Knowing it’s now that comma … I’m unsure if removing it , and autoformating it again will change it back - I can try that sometime , otherwise a pain if you make the mistake of leaving one in .

It will not.

Well, you can revert changes made by the auto format by performing an "Undo" (e.g., Edit > Undo).

However, this only works if you notice that it made unwanted changes, so you might decide you prefer the completely reasonable solution that @sterretje provided.