go DMD – Dateien auf der SD Karte

Filesystem

Die SD Card sollte mit FAT16 oder FAT32 formatiert sein und maximal 2GB gross sein. Sie kann durch Verwendung des FAT Filesystems mit jedem Computer Linux oder Windows beschrieben werden.

Wurzelverzeichnis

Das Wurzelverzeichnis enthält normalerweise drei Files:

  • foo.ani: die Animationen in kompilierter Form.
  • fontX.dat: die Schriften für die Uhr in gross und klein. X läuft von 0 bis n (n=Anzahl der Schriften)
  • option.dat: die gespeicherten Einstellungen des Config-Menüs.

Wenn entweder foo.ani oder font.dat fehlen bzw. nicht gefunden werden, dann wird direkt beim Start ein Fehler erzeugt.

Dateiformate

Animationen: foo.ani.

Diese Datei enthält die Frames für die Animationen. Sie wird durch den Editor erzeugt. Alle Zahlen werden in der “BIG_ENDIAN” Reigenfolge gespeichert, d.h. das höherwertige Byte zuerst. Es gibt inzwischen drei Versionen des Formats die jeweils aufeinander aufbauen.

4 Byte Header: ANIM
2 Byte Version: 00 0X
   x is 1, 2 or 3 depending on actual version
2 Byte Anzahl der Animationen: 00 02

for version 2 and newer:
N * 4 byte index that gives a direct offset into the anis file for
   each animation 

for each animation:
N Byte Name der Animation in modified UTF-8
   first 2 Byte gives length of string incl 2 byte length header
2 Byte: cycles
2 Byte: hold
2 Byte: clockFrom
1 Byte: clock small
1 Byte: clock in front
2 Byte: xoffset for small clock
2 Byte: yoffset for small clock
2 Byte: refresh delay in millis
1 Byte: Animation Type (not relevant)
1 Byte: fsk tag
2 Byte: frame set count

for version 2 and newer:
   2 bytes: palette number (1-9 refering to standard palettes)
   2 bytes: number of colors in palette
   if number of colors in palette greather than 0
      for each color: 1 byte red, 1 byte green, 1 byte blue

for version 3 and newer:
   1 byte edit mode: replace, mask or fixed (depends on use in editor)
each frame consists of 2 or more planes and optionally a mask plane
each plane is tagged with its type 0,1,2, .. for normal bitplanes in
grayscale animations or M ( for mask, the order is always m,0,1,2
where m and 2 are optional. "true color" anis have 15 planes, 5 for 
each color.

for version 4 and newer:
   2 bytes: width in pixel
   2 bytes: height in pixel

for version 5 and newer:
   animations can hold additional masks per animation. this is
   used to generate custom keyframe hashes that are valid only
   for one animation
   2 bytes: no of additional masks
   foreach mask:
      1 byte: masked is locked.
      2 byte: length of mask data in byte
      n byte: mask data

for version 6 and newer:
   optional persists a link to a recording where the animation was 
   cut out. this is used only in the editor itself and can be ignored
   for playback.
   1 byte: 1 if recording link is stored
      record link:
      N byte name of recording (modified utf-8 with length see above)
      4 byte: integer starting frame (within recording)
foreach frame:
    2 Byte: plane size in Byte. normally 512 byte
    2 Byte: frame duration in ms
    1 Byte: number of planes
    for version 3 and newer:
    1 byte: plane format:
       if 0: old uncompressed format
       else:
          4 byte length of compressed block that follows
    
    old uncompressed format:
      foreach plane:
          1 Byte: type of plane, m,0,1,2 see above
          plane size Byte frame data: 1 Bit = 1 Pixel
          Bit 7 is pixel on the left (BIG_ENDIAN)
      end
    new compressed format:
      same as above but compressed using heatshrink compression
      using a window size of 10 and look ahead of 5
end

for heatshrink see https://github.com/atomicobject/heatshrink
or in java https://github.com/sker65/heatshrink-java

Die Schriften

Die Font Dateien haben diesen Aufbau:

Jeder fontX.dat besteht aus vier gleich aufgebauten Blöcken: Grosse Schrift, grosse Schrift-Maske, kleine Schrift und kleine Schrift-Maske. Jeder der Blöcke ist so aufgebaut:

1 Byte: number of chars in font
1 Byte: char e.g. '1'
1 Byte: width
1 Byte: height
2 Byte: size of data 
n Bytes: font data

Das font data Segment selbst ist eine einfache schwarz weiss Bitplane mit den Zeichen Daten. Zeilen sind immer komplette Bytes, padding ist rechts.

Bei einen Zeichen 16×32 gross sind das also genau 64 Byte immer zwei pro Zeile. Bei einem Zeichen 9×32 sind es auch 64 Byte, aber die unteren 7 Bit des jeweils zweiten Byte sind irrelevant (padding).

Die gespeicherten Einstellungen option.dat.

Die option.dat Datei hat einen sehr einfachen Aufbau. Für jeder Einstellung aus dem goDMD Menü enthält sie genau ein Byte. Diese Byte entspricht der gewählten Option bei einem bestimmten Menüeintrag als Zahl.

Wenn man also das Menü durchblättert, dann ist der erste Eintrag Helligkeit (dunkel, mittel, hell). Also entspricht das erste Byte in der Option.dat dieser Einstellung, gespeichert als 0,1,2.

Zu beachten ist noch das die Uhrzeiteinstellungen zwar mit gespeichert werden, aber die Werte natürlich bei erneuten Laden ignoriert werden. Man kann daran aber ablesen, wann die Optionen zuletzt gespeichert wurden.

Einen kompletten Satz an Files, die dem Auslieferungszustand entsprechen, läßt sich hier runterladen.

Dieser Beitrag wurde unter Allgemein veröffentlicht. Setze ein Lesezeichen auf den Permalink.

Hinterlasse eine Antwort

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind markiert *

Du kannst folgende HTML-Tags benutzen: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>