Error compiling ESPboy_FirstTest

it’s better to use ESP_EEPROM lib

That is the one I used. It uses flash to emulate eeprom, which is why I think it messed up my flash somehow, but I don’t even know how that would be possible to permanently mess it up. Anyway, after trying out that lib the display is broken. I’ll figure it out, DW :slight_smile:

miracle )
try to recompile and upload the ESPboy with this option set

Hmm that seemed very promising, but seems like it doesn’t help :grimacing: I am trying pushImage now, but looks like 128*128 u16 buffer doesn’t fit into RAM.

EDIT: Is there a way to forcefully completely recompile the whole project? I was messing with compiler flags and may have broken the display library in theory.

it’s better to store the screen not 128x128 u16
if you’ll check my ZX Spectrum emulator or GB emulator or Arduboy2 render
you’ll find the way to storiy the screen buff in lower bits resolution, and dynamicly form the 128x1 u16 line und push it to the LCD with pushimage()
all 128 lines
or less if you have different parts of the screen with different info (playscreen/scoreinfo)

check lcd_draw_line() here for example

i suppose that you have to close standard Arduino IDE and reopen it and the project.
and “compile” will recompile the whole project. i believe it )

I have just randomly fixed it :sweat_smile: I’ve put fillScreen and setAddrWindow in the init function and it works.

Okay, now to get the EEPROM working… but I’ll leave that for tomorrow.

Thanks for assistance. This is a nice community indeed :slight_smile:

2 Likes

About the EEPROM emulating library:

As I understand it, if two programs are using it, they will overwrite each other’s data unless they have some special system of cooperation, correct? This is not like with classic EEPROM where each program can choose some random address and minimize probability of colliding with some other program’s data, this library is just supposed to be used by only one program. If this is true, I’ll rather think about not supporting data saving.

As far as I can tell, it’s the same as “classic” EEPROM. The only difference is that you have to do a begin() to initialise, and you have to do a commit() to flush any changes.

You may have to use the same size in begin() for all programs that you want to have share the EEPROM space. (Without having looked at the implementation) it’s possible that using different sizes could cause EEPROM corruption between using different programs. If you wanted compatibility with Arduino UNO and Leonardo AVR based boards, you could use size 1024.

1 Like

It says it is for saving “small” amount of data and they have like 16 bytes in the examples, so I suppose begin should be called with something similar? Wouldn’t 1024 be too much? I think each write adds a record of this size to the flash. I think I’ll make enabling saves a compile time option.

Then we will have to use a global map of eeprom use to be able to play different games and be able to save states / data of games. If size is fixed to 1024, it’s make how many possibilities of games data spaces ?

Another question: is it too difficult to play a sound wave from memory? Now I can do beeps with Arduino’s tone() function, but it would be cool to be able to play any 8bit sound from the memory.

True, the entire size specified in begin() will probably be written on each commit(). The need to do commits is intended to compensate for this somewhat.

If it’s a concern, one of the EEPROM wear levelling techniques could be used. This is the kind of thing @RomanS should be thinking about before many programs start using EEPROM. Not having a standard up front for EEPROM use is what caused the “wild west” scenario with the Arduboy.

For larger amounts of data, and not having to worry about data conflicting with other programs (because of using named files) the LittleFS file system (and also the depricated SPIFFS file system) is available for non-volatile data storage.

If you mean an actual analog waveform, then it’s not possible. There is no DAC output available. The voltage on the speaker can strictly be set only high or low, thus limiting it to square or rectangular waveforms.

There is also no hardware pulse width modulation (PWM) capability. If you wanted to get analog output equivalent using PWM you would have to do it with software, which may end up too slow or too CPU intensive.

1 Like

i’m not experienced in sound but actually there are two ways to play digital sound on ESP8266

  1. use additional I2S board for high quality sound video
  2. software play with bit banging and sigma-delta modulation

check ESPboy AY-38910 sound chip emulator here

choose output device in ESPboy_PT3Play.ino
#define OUTPUT_DEVICE OUT_SPEAKER
//#define OUTPUT_DEVICE OUT_I2S

EDIT
and there is port of ArduboyPlayune for synth music player which is also a kind of digital sound

1 Like

what do you mean “if two programs are using it”? :slight_smile:
i’m always using esp8266 as single task device so no way to use EEPROM by different programs )

Not at the same time. I mean one game saves something, then you turn it off and upload another game which also saves something and overwrites the previous game’s data. With “normal” EEPROM that has e.g. 4kb game A can save its data to address X and game B to address Y.

i see. have to do some experiments about it…
but i’m not sure it’s important. anyway soon i’ll make online storage of the records and data for games are exposed in ESPboyAppStore

but as @MLXXXp said, you can save game’s data to the LittleFS internal ESPboy internal flash drive

If we use it, we could have somewhere in github a catalog of taken spaces (reserved) for save games high scores / progression (as said upper in the conversation, some games could only take one ‘slot’ and some could take more as it’s can use more space for an adventure game than to store a top 10 score for a Pong… Depending of the space allowed for a slot, a programmer for some games could even use one slot for many games as long as he reserved it and manage how to store it in this reserved space. But you’ll have to keep this catalog up to date with informations given by developpers

Wait, there is an internal flash storage separate from the program flash? LittleFS looks like something that can only upload data there from my PC, I need to save data from my program also.

EDIT: OK I found the documentation.

So I think it’s better to use LittleFS file to save data instead of using EEPROM, as LittleFS will prevent conflicts of different programs, ok?

1 Like