Playing with oled-exp
-
@Garth-Minette Right, I can use shell substitution but it doesn't properly deal with whitespace. (E.g. try your example out and you'll see. You'll need to quote the backticks with double quotes as 'write' expects a single argument, so oled-exp write "`ls -1`". The OLED will display the output of ls with no newlines at all.) xargs definitely won't work as the best I could do then is end up with a series of strings that have to be quoted anyway, destroying the newlines.
What I want is to be able to redirect stdin to oled-exp so that it can be used as the terminus of an actual pipeline, which I don't see a way to do.
-
It's not particularly elegant, but if anyone else runs into this I knocked together a workaround. I created a little script I called 'oprint':
oled-exp -c write "`awk -vRS="\n" -vORS="\\\\\n" '1' $*`"
This can then be used in a pipeline, like so:
ls -1 | ./oprint
This gives me the expected output on the OLED display.
-
@fader OLED initialization does a few things such as turning the screen on, placing the cursor at the top left of the screen, turn off scrolling, etc.
Right now to add the new line you need to do
\\\\\n
. We are working on changing this hack to something more elegantRight now the screen is programmed with the following characters:
static const uint8_t asciiTable[][OLED_EXP_CHAR_LENGTH] = { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // SPACE {0x00, 0x00, 0x4F, 0x00, 0x00, 0x00}, // ! {0x00, 0x07, 0x00, 0x07, 0x00, 0x00}, // " {0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00}, // # {0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00}, // $ {0x23, 0x13, 0x08, 0x64, 0x62, 0x00}, // % {0x36, 0x49, 0x55, 0x22, 0x50, 0x00}, // & {0x00, 0x05, 0x03, 0x00, 0x00, 0x00}, // ' {0x00, 0x1C, 0x22, 0x41, 0x00, 0x00}, // ( {0x00, 0x41, 0x22, 0x1C, 0x00, 0x00}, // ) {0x14, 0x08, 0x3E, 0x08, 0x14, 0x00}, // * {0x08, 0x08, 0x3E, 0x08, 0x08, 0x00}, // + {0x00, 0x50, 0x30, 0x00, 0x00, 0x00}, // , {0x08, 0x08, 0x08, 0x08, 0x08, 0x00}, // - {0x00, 0x60, 0x60, 0x00, 0x00, 0x00}, // . {0x20, 0x10, 0x08, 0x04, 0x02, 0x00}, // / {0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00}, // 0 {0x00, 0x42, 0x7F, 0x40, 0x00, 0x00}, // 1 {0x42, 0x61, 0x51, 0x49, 0x46, 0x00}, // 2 {0x21, 0x41, 0x45, 0x4B, 0x31, 0x00}, // 3 {0x18, 0x14, 0x12, 0x7F, 0x10, 0x00}, // 4 {0x27, 0x45, 0x45, 0x45, 0x39, 0x00}, // 5 {0x3C, 0x4A, 0x49, 0x49, 0x30, 0x00}, // 6 {0x01, 0x71, 0x09, 0x05, 0x03, 0x00}, // 7 {0x36, 0x49, 0x49, 0x49, 0x36, 0x00}, // 8 {0x06, 0x49, 0x49, 0x29, 0x1E, 0x00}, // 9 {0x36, 0x36, 0x00, 0x00, 0x00, 0x00}, // : {0x56, 0x36, 0x00, 0x00, 0x00, 0x00}, // ; {0x08, 0x14, 0x22, 0x41, 0x00, 0x00}, // < {0x14, 0x14, 0x14, 0x14, 0x14, 0x00}, // = {0x00, 0x41, 0x22, 0x14, 0x08, 0x00}, // > {0x02, 0x01, 0x51, 0x09, 0x06, 0x00}, // ? {0x30, 0x49, 0x79, 0x41, 0x3E, 0x00}, // @ {0x7E, 0x11, 0x11, 0x11, 0x7E, 0x00}, // A {0x7F, 0x49, 0x49, 0x49, 0x36, 0x00}, // B {0x3E, 0x41, 0x41, 0x41, 0x22, 0x00}, // C {0x7F, 0x41, 0x41, 0x22, 0x1C, 0x00}, // D {0x7F, 0x49, 0x49, 0x49, 0x41, 0x00}, // E {0x7F, 0x09, 0x09, 0x09, 0x01, 0x00}, // F {0x3E, 0x41, 0x49, 0x49, 0x7A, 0x00}, // G {0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00}, // H {0x00, 0x41, 0x7F, 0x41, 0x00, 0x00}, // I {0x20, 0x40, 0x41, 0x3F, 0x01, 0x00}, // J {0x7F, 0x08, 0x14, 0x22, 0x41, 0x00}, // K {0x7F, 0x40, 0x40, 0x40, 0x40, 0x00}, // L {0x7F, 0x02, 0x0C, 0x02, 0x7F, 0x00}, // M {0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00}, // N {0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00}, // O {0x7F, 0x09, 0x09, 0x09, 0x06, 0x00}, // P {0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00}, // Q {0x7F, 0x09, 0x19, 0x29, 0x46, 0x00}, // R {0x46, 0x49, 0x49, 0x49, 0x31, 0x00}, // S {0x01, 0x01, 0x7F, 0x01, 0x01, 0x00}, // T {0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00}, // U {0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00}, // V {0x3F, 0x40, 0x30, 0x40, 0x3F, 0x00}, // W {0x63, 0x14, 0x08, 0x14, 0x63, 0x00}, // X {0x07, 0x08, 0x70, 0x08, 0x07, 0x00}, // Y {0x61, 0x51, 0x49, 0x45, 0x43, 0x00}, // Z {0x00, 0x7F, 0x41, 0x41, 0x00, 0x00}, // [ {0x02, 0x04, 0x08, 0x10, 0x20, 0x00}, // backslash {0x00, 0x41, 0x41, 0x7F, 0x00, 0x00}, // ] {0x04, 0x02, 0x01, 0x02, 0x04, 0x00}, // ^ {0x40, 0x40, 0x40, 0x40, 0x40, 0x00}, // _ {0x00, 0x01, 0x02, 0x04, 0x00, 0x00}, // ` {0x20, 0x54, 0x54, 0x54, 0x78, 0x00}, // a {0x7F, 0x50, 0x48, 0x48, 0x30, 0x00}, // b {0x38, 0x44, 0x44, 0x44, 0x20, 0x00}, // c {0x38, 0x44, 0x44, 0x48, 0x7F, 0x00}, // d {0x38, 0x54, 0x54, 0x54, 0x18, 0x00}, // e {0x08, 0x7E, 0x09, 0x01, 0x02, 0x00}, // f {0x0C, 0x52, 0x52, 0x52, 0x3E, 0x00}, // g {0x7F, 0x08, 0x04, 0x04, 0x78, 0x00}, // h {0x00, 0x44, 0x7D, 0x40, 0x00, 0x00}, // i {0x20, 0x40, 0x44, 0x3D, 0x00, 0x00}, // j {0x7F, 0x10, 0x28, 0x44, 0x00, 0x00}, // k {0x00, 0x41, 0x7F, 0x40, 0x00, 0x00}, // l {0x78, 0x04, 0x78, 0x04, 0x78, 0x00}, // m {0x7C, 0x08, 0x04, 0x04, 0x78, 0x00}, // n {0x38, 0x44, 0x44, 0x44, 0x38, 0x00}, // o {0x7C, 0x14, 0x14, 0x14, 0x08, 0x00}, // p {0x08, 0x14, 0x14, 0x18, 0x7C, 0x00}, // q {0x7C, 0x08, 0x04, 0x04, 0x08, 0x00}, // r {0x48, 0x54, 0x54, 0x54, 0x20, 0x00}, // s {0x04, 0x3F, 0x44, 0x40, 0x20, 0x00}, // t {0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00}, // u {0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00}, // v {0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00}, // w {0x44, 0x28, 0x10, 0x28, 0x44, 0x00}, // x {0x0C, 0x50, 0x50, 0x50, 0x3C, 0x00}, // y {0x44, 0x64, 0x54, 0x4C, 0x44, 0x00}, // z {0x00, 0x08, 0x36, 0x41, 0x00, 0x00}, // { {0x00, 0x00, 0x7F, 0x00, 0x00, 0x00}, // | {0x00, 0x41, 0x36, 0x08, 0x00, 0x00}, // } {0x0C, 0x02, 0x0C, 0x10, 0x0C, 0x00}, // ~ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00} };
Because the Omega has quite a bit of RAM (compared to microcontrollers), you can actually define quite a bit more characters. I have seen implementations of the drivers showing Japanese characters.
Yup, we are also working on the escape hacks on the Console side of things.
-
Awesome info, thank you @Boken-Lin!
-
Now that I have had hands on experience with oled-exp, this is what worked for me, including preserving whitespace and newlines:
oled-exp -c write "$(ls -FCs1|sed 's/$/\\n/g')"
-
Because I like poking at things, I keep pushing on what I can get oled-exp to do I've hit a couple of bugs with it while playing more.
An interesting one is that oled-exp attempts to parse strings that start with a dash '-' as switches, even if they are quoted (either single or double quotes). E.g.
oled-exp write '-c'
will clear the display and write an empty string instead of writing the literal '-c' to the display. I have also tried escaping the dash but get the same behavior.
I also can't get the cursor positioning to work for columns. Rows work fine:
oled-exp cursor 7,0 write "I am the bottom line"
does what is expected, but
oled-exp cursor 4,8 write "center"
puts the text at line 4 column 0 rather than column 8. Though stdout from oled-exp claims that it is doing the right thing:
> Setting cursor to (4, 8) > Writing 'center' to display
-
@fader Thanks for pointing out these bugs. We will add them to our list and get them sorted out for the next release
-
Awesome, thanks @Boken-Lin! Is there a bug tracker I should use in the future or is this community site the best place to report such things?
-
@fader You should create an issue on our Github repo here: https://github.com/OnionIoT/i2c-exp-driver.
-
I experienced the bug with the cursor as well. Issue on github: https://github.com/OnionIoT/i2c-exp-driver/issues/2
-
@BeneKenobi Thanks for reporting the bug!
-
@fader @BeneKenobi
Thanks for the bug reporting guys!
Please upgrade your Omega firmware to b236, the cursor issue has been addressed and should be working now
-
Just updated from b234 to b236, now the Image function of the OLED Expansion Control of the Control Panel displays the image in a torn, skewed manner. It worked correctly in b234. Worked correctly in b234.
Issue on github: https://github.com/OnionIoT/i2c-exp-driver/issues/3
-
I'm seeing the same thing as @BeneKenobi and have uploaded a picture of the skewed image to his bug report.
I'm also now able to escape a string starting with a dash using a backslash (i.e. \-mystring) but not in quotes (either single or double, i.e. '-mystring' or "-mystring"). Not sure if this is expected behavior or not so I haven't updated/filed a bug on that yet.
-
@Scott-Smith, @fader: Thanks for the update. We will take a look!
-
@Scott-Smith, @fader: oversight on my part with the cursor fix, sorry, it's fixed now tho.
Pick up b238, the draw isn't skewed anymore (and the cursor still works )
-
@Lazar-Demin Thanks for the fast update! Unfortunately, b238 seems to have a different skew, where some rows of pixels from the bottom of the image are pushed to the top. I've attached an example to the ticket in Github.
Additionally, after displaying an image and then using 'oled-exp -c' a few pixels in the rightmost few columns are left on. This persists when text is written to the display.
(But the cursor control seems to be working )
-
(@Lazar-Demin Please let me know if you'd rather have a separate ticket for the new skew issue and/or the ghosting of pixels after a screen clear. I added comments to the existing issue but it's closed, so happy to open a new one if that's better.)
-
@fader I reopened that same ticket. I'm hoping to fix this sometime today, if not, then tmrw!
-
Thanks, @Lazar-Demin! I'm in no hurry, just trying to let you know what I see