Announcement

Collapse
No announcement yet.

Using ViSi-Genie-RaspPi-Library: I'm not getting any events from the display

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • pkourany
    replied


    theColonel26,

    Which 4D display are you using? Is the TX & RX wiring correct to the display (possibly reversed)? You may want to test this by doing a writeContrast() to turn off the display, then back on as follows (insert code prior to loop):

    genieWriteContrast(0); // turn off the display backlight
    delay (1000);
    genieWriteContrast(1); // turn the display backlight on again

    The blink will be obvious. If this does not work then you have a serial connection problem (wiring or baudrate on the 4d display unit when you programmed it)

    I have used the exact loop in my code without any problems. However, I used a logic probing scope (xprotolab from gabotronics) to trace the serial comms between the Pi and the display to prove that it was working correctly.

    Let me know how it goes

    Leave a comment:


  • Using ViSi-Genie-RaspPi-Library: I'm not getting any events from the display

    The the contents of this while loop are never executed

    Code:
    while (genieReplyAvail ())
     {
       genieGetReply    (&reply) ;
       handleGenieEvent (&reply) ;
     }

    Relevant C++ code
    Code:
    extern "C" { 
    #include <wiringPi.h>
    #include <piFace.h>
    #include <string.h>
    }
    #include <iostream>
    #include <ctime>
    #include <thread>
    #include <geniePi.h>
    
    using namespace std;
    
    #define RUNNING_LED 0
    
    void handleGenieEvent (struct genieReplyStruct *reply)
    {
      if (reply->cmd != GENIE_REPORT_EVENT)
      {
        printf ("Invalid event from the display: 0x%02X\r\n", reply->cmd) ;
        return ;
      }
    
      if (reply->object == GENIE_OBJ_WINBUTTON)
      {
        if (reply->index == 0) // Button 0 -> Start
        {
     cout << "Start Button Pressed" << endl;
     genieWriteObj (GENIE_OBJ_USER_LED, RUNNING_LED, 1) ;
        }
        else if (reply->index == 1) // Button 1 -> Stop
        {
     cout << "Stop Button Pressed" << endl;
     genieWriteObj (GENIE_OBJ_USER_LED, RUNNING_LED, 0) ;
        }
        else
     {
          printf ("Unknown button: %d\n", reply->index);
     }
      }
      else
      {
        printf ("Unhandled Event: object: %2d, index: %d data: %d [%02X %02X %04X]\r\n", reply->object, reply->index, reply->data, reply->object, reply->index, reply->data) ;
      }
    }
    
    int main(int argc, char *argv[])
    {
     wiringPiSetupSys();
     piFaceSetup(200);
    
     struct genieReplyStruct reply;
    
     if (genieSetup ("/dev/ttyAMA0", 115200) < 0)
     {
     fprintf (stderr, "rgb: Can't initialise Genie Display: %s\n", strerror (errno)) ;
     return 1 ;
     }
    
     //Input btn0(200);
     //Input btn1(201);
     //Input btn4(204);
     //Input btn5(205);
    
     bool run = true;
    
     Blinker blinky;
    
     //** function states
     bool blinker = false;
    
     //** output states
    
    
     cout << "Hello" << endl;
    
     while (run)
     {
     
     while (genieReplyAvail ())
     {
       genieGetReply    (&amp;reply) ;
       handleGenieEvent (&amp;reply) ;
     }
    
     }//** end while
    
     return 0;
    }
Working...
X