Please correct me if there's a flaw in my understanding. The way I currently see the code works is that all Instinct skills are written to the I2C EEPROM and the Newbility skills (currently only stair) is written to the onboard EEPROM. The onboard EEPROM writing happens during the call to assignSkillAddressToOnboardEeprom(). This currently happens every time the Nybble boots - it's in the setup() function of Nybble.ino. Is there a reason for this? We should only need to do it once when we update the skills from WriteInstinct.ino. Also, why did you decide to store stair in the onboard memory instead of offboard?
Side note: Your comment about why is the IR key printed twice is because you have two calls to translateIR() on lines 407 & 408.
Climbing up stairs is cool. would make the paws sharpen?
EEPROM has limited (1,000,000) write cycles. I want to minimize write operations on it.
There are two kinds of skills: Instincts and Newbility. I2C EEPROM (8KB) stores Instincts. PROGMEM (sharing the 32KB flash with the sketch) stores Newbility. Their addresses are written to the onboard EEPROM(1KB) as a lookup table.
The Instincts are already fine-tuned/fixed skills. Multiple Instincts are linearly written to the I2C EEPROM only once with WriteInstinct.ino. Their addresses are saved to the lookup table in onboard EEPROM during the runtime of WriteInstinct.ino.
A Newbility is a new experimental skill that requires a lot of tests. It's not written to the I2C nor onboard EEPROM, but the flash memory in the format of PROGMEM. It has to be uploaded as one part of Arduino sketch. Its address is also assigned in runtime of the code, though its value rarely changes if the total number of skills (including all Instincts and Newbilities) is unchanged.
assignSkillAddressToOnboardEeprom() only assigns those Newbilities' PROGMEM address to the lookup table in onboard EEPROM.
All the writing functions I use for EEPROM are actually updating functions. They compare the bytes and only write if the values don't match. Because in most cases the address value is unchanged, the update function won't do write operations on the EEPROM.
The stair skill is a new motion plan I'm experimenting on. As indicated by its name, I want to make Nybble climb up stairs.
--
Thanks for catching the bug with translateIR! I think I added the printing information for debugging at some point that resulted in printing twice. I'll save its return value to avoid double prints.