spuder / All-Spark-Cube

Software to control an RGB led cube
20 stars 6 forks source link

3d Save status of leds to file #6

Closed spuder closed 12 years ago

spuder commented 12 years ago

There are several options for outputting the state of all leds

  1. csv
  2. tsv
  3. xml
  4. json

An example would be such as

csv: Led# red green blue brightness 0-0-0 255 255 255 75

json: 000 - "{255,255,255,75}"

The best is either json or tsv. xml is popular but results in files much larger than they need to be. The main reason to use a xml is to show relationships. The led cube has relationships but the advantages of showing them is outweighed by the difficulty of parsing xml. This file will be sent to the interpreter. If the interpreter is on the computer, the file type will not matter. If the interpreter is on the arduino, the fastest and easiest to transport over serial/networking method should be used.

Research and implement in sandbox, saving the status of objects to a file

Research the following: QCJson, FileInputStream, FileOutputStream, JSONUtilities.stringify

Ask spencer for his book on java serialization.

spuder commented 12 years ago

Currently saves just the led value if true (0-0-0).

Still need to test that unchecking led actually removes it.

Changed from Hashmap to tree map to get additional sorting. Needs benchmarks since tree maps are slower

tbenz9 commented 12 years ago

We should save the text files with the timestamp so they can be easily sorted.

spuder commented 12 years ago

I agree. We should also be able to choose the file that we save to.

spuder commented 12 years ago

I think this one is pretty much done as well. Will need to tweak it depending on the final csv file layout and then update it when we switch to json.

tbenz9 commented 12 years ago

right now it exports to a file in the following format "absolute_location color/off" For example "2098 red" or "3456 off". It also lets you pick a file on export and import. We will have to switch to JSON for more features later.