Skip to content
Browse files

rename y_offset to x_offset

  • Loading branch information...
1 parent 8d18d11 commit ee42b40a50da8174693de2bd27dc1db4d68b09d3 @osresearch committed Aug 10, 2013
Showing with 14 additions and 8 deletions.
  1. +5 −4 BeagleBone-setup.md
  2. +9 −4 teensy-udp-rx.c
View
9 BeagleBone-setup.md
@@ -29,12 +29,12 @@ Teensy config
* Update `config.txt`. At the minimum it needs the first line with the
maximum strip length and the UDP port number, and four lines for the
-teensy serial IDs and their Y-offset in the image buffer. It is ok
+teensy serial IDs and their X-offset in the image buffer. It is ok
to have teensys that are not in use with this BBB so that the same
config file can be used with all of them.
9999 # UDP port
- 64,256 # Image width x height
+ 64,210 # Image width x height
14401,0
14389,8
8987,16,1:9,0:8
@@ -43,13 +43,14 @@ config file can be used with all of them.
* If there are any bad pixels, they go on the line with that ID. In the
above example, there are two bad pixels, both on the same teensy.
Pixel #9 on strip #1 and pixel #8 on strip #0 are marked as "bad" and
-will not be set to anything other than black.
+will not be set to anything other than black. Bad pixels are
+measured from the start of the strip, not the image.
* Run `teensy-rx-udp` on the BeagleBone. It should report opening all
four serial ports and querying them to find out their configured pixel
lengths (which *must match the config file*):
- root@beaglebone:~/LEDscape# ./teensy-udp-rx config.txt
+ root@beaglebone:~/LEDscape# ./teensy-udp-rx config.txt
8987: bad 1:9
8987: bad 0:8
/dev/ttyACM0: ID 8998 width 10
View
13 teensy-udp-rx.c
@@ -32,14 +32,19 @@ static unsigned width = 64;
static unsigned height = 210;
+/** Extract a ADDRESSING_HORIZONTAL_NORMAL pixel from the image.
+ *
+ * This reverses the y since the teensy's are at the bottom of the
+ * strips, while the image coordinate frame is at the top.
+ */
static const uint8_t *
bitmap_pixel(
const uint8_t * const bitmap,
const unsigned x,
const unsigned y
)
{
- return bitmap + (y * width + x) * 3;
+ return bitmap + ((height - y - 1) * width + x) * 3;
}
@@ -184,7 +189,7 @@ typedef struct
typedef struct
{
unsigned id;
- unsigned y_offset;
+ unsigned x_offset;
teensy_dev_t * dev;
uint8_t bad[MAX_PIXELS]; // which pixels are to be masked out
} teensy_strip_t;
@@ -396,7 +401,7 @@ read_config(
int offset = 0;
int rc = sscanf(line, "%u,%u%n",
&strip->id,
- &strip->y_offset,
+ &strip->x_offset,
&offset
);
@@ -548,7 +553,7 @@ main(
bitslice(
slice + 3,
buf + 1,
- strip->y_offset,
+ strip->x_offset,
strip->bad
);

0 comments on commit ee42b40

Please sign in to comment.
Something went wrong with that request. Please try again.