It’s not been that long since my last entry, but I’ve managed to complete this version quicker than I expected.

Multiple Sessions

In this version, I’ve concentrated on the ability to record and view multiple training sessions, rather than just one. Before this version, each swim would over-ride the pervious one, and there was no way of viewing any previous swims (an obvious limitation for actual use!).

In order to make that work well, I had to decide on how the memory was to be organised. Although I’m sure what I’ve done is not the most efficient, I’ve worked on the following:

  • The first two bytes of the EEPROM store a unique ID code (which I’ve actually yet to implement).
  • Byte 2 (assuming 0 as the starting byte) store the number of sessions that have been recorded
  • Then for each session:
    • The first 3 bytes store session start date
    • The next 3 bytes store the session start time
    • The next byte stores the number of lengths in the session
    • The next two bytes store the total length in seconds (which gives a max. total time of just over 18 hours)
    • Then the 246 bytes store the time of the time for each length in seconds

But since everyone prefers pictures 🙂

Memory storage

 

This gives 255 for each session. However, since each page in the EEPROM is 32 bytes, I might look at making some multiple of this (and perhaps store some stuff in memory and then “dump” it to the EEPROM). This gives a maximum of 31 recorded sessions, which for now is fine.

In this version, I’ve added the ability to delete sessions, but for now, you only have the choice of deleting all the sessions. I think it would be easy enough to add the ability to delete specific sessions, but I’ll leave that for the future (or to someone else if anyone’s interested in doing some development…)

History Menu

In order to make viewing the history a bit easier, I’ve added another menu, which you access with the “History” option on the main menu. From this menu, you now have 3 options:

  • Show Which allows you to view scroll through the sessions by pressing up or down(or states “No History” if there’s no recorded sessions)
  • Delete Which goes to another screen asking for confirmation that you wish to delete all the history
  • Details Which will show you the number of swimming sessions that are recorded (I might edit this so it also shows you how much training sessions are can currently store in memory)

I’d like to upload a video of the current history menu, but I’m currently unable to upload videos and probably will be for a few weeks.

Coming Up…

I’m now at the point here I want to start designing the PCB so that I can start testing the device in the pool. Therefore I’m in the process of redesigning the circuit diagram using Eagle CAD. I’ll then use this circuit to design and build a small PCB for testing. However, I don’t have any PCB fab facilities so I’ll be sending it off to be made, which will take about a month to arrive.

Also, my code is VERY messy and I’d like to clean it up. However, this is my first real project with C so I’m unsure how to go about that. So far, everything is in the main.c file, but when I try and split the code into seperate files, I get too many error messages that I can’t figure out. Therefore I’m going to start doing some reading on how to organise C programs better and hopefully improve the design.

I’m actually much more confirable programming in C++, where I can use Classes to clean things up and separate larger files.

Advertisements