Announcement

Collapse
No announcement yet.

Weird behavior when using SPI

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

  • tonton81
    replied
    was it working before?
    what does it do? nothing at all on screen?
    how are your connections? (common ground? shield??

    Leave a comment:


  • CaM
    replied
    So I got it to compile but seem to be missing something. If someone has a spare min to take a look that'd be hugely appreciated.

    Thanks!

    https://drive.google.com/open?id=1rl...jafJW-DuvZ9GS2

    Seems I no longer have tx/rx flashing on the arduino
    Last edited by CaM; 5th December 2018, 06:32 PM.

    Leave a comment:


  • tonton81
    replied
    should be a period “.” after genie

    Leave a comment:


  • CaM
    replied
    Hey guys. So I decided to re-format my code to only write to objects currently visible on each form. I'm not 100% sure I've done it right, and can't resolve this compile error

    [EDIT] - I have since realised I'm not using genieDequeueEvent. This is a copy paste error... I'll give this a go

    exit status 1
    'genieDequeueEvent' was not declared in this scope
    I think I have all the curly brackets in the right places. Further reading required. Have attached my code if anyone is interested.

    Cam
    Last edited by CaM; 5th December 2018, 06:06 PM.

    Leave a comment:


  • tonton81
    replied
    Assuming you know the form the LCD boots to, every time you switch form just update a global variable with the new number and refer to that when writing to objects

    Leave a comment:


  • CaM
    replied
    Heya Michael

    Thanks for the reply. I'm using the same method of writing to the gauge as I have the others eg.

    genie.WriteObject(GENIE_OBJ_COOL_GAUGE, 7, H2oTemp); Does this look OK?

    However, after much googling I think I have something I need to take a look at first. I've not much time to do it today, but will try to take a look tomorrow. Basically I think I've been writing to all gauges on every form, each loop. I've since read somewhere this can cause issues and maybe seeing as these were the last 2 to be added, they are the ones where it has started to cause a problem. My question is, whats the best way to write to an object only when that form is active? It appears I need to use the events handler and report to the arduino what form is active. I'm just struggling to understand that part, but haven't had the chance to implement anything yet, or read up on it too much.

    I had a quick few minutes and basically created a new project and added 5 coolgauges. The fifth one was updating (this is the first one that had a problem on my actual project) along with the others in real time. This is what makes me now believe I'm going about it the wrong way when it comes to writing to the 4d screen with 6 different forms.

    Any quick example of the form active and how to only write to that form would be a lot of help if you have that available, else I'll get studying as soon as I have some more free time!

    It's coming along nicely

    I'll bundle up the code tomorrow if I get a chance! Cheers

    Leave a comment:


  • michael_4D
    replied
    Hello,

    Just to be clear you got your project working by redoing your GUI right?
    Just now I created a new 4d screen with some gauges and they all update in real time using the same arduinoi code ( added 5 gauges, no.5 is what my thermocouple display temp is).
    I then add a new form and new gauge to original set of screens, try adding that to my code but it doesn't update...
    Are you sure you're calling the correct parameters? for example, are you calling the correct object ID and object index to write to?

    If you don't mind, would it be possible to send your Arduino code and genie project? I think it'd be easier for us to help you that way.

    Best regards,

    Leave a comment:


  • CaM
    replied
    Well..... I've since switched the BMP to SPI along with thermocouples....no dice. I then used software SPI for thermocouples.....no dice. Just now I created a new 4d screen with some gauges and they all update in real time using the same arduinoi code ( added 5 gauges, no.5 is what my thermocouple display temp is). What gives? I then add a new form and new gauge to original set of screens, try adding that to my code but it doesn't update....Anyone had a gauge or digits not update, but everything else does? Driving me nuts!

    Leave a comment:


  • CaM
    started a topic Weird behavior when using SPI

    Weird behavior when using SPI

    Hi again!

    Quick info
    - Arduino Nano
    - 4D-SK-32PTU-AR Screen
    - i2c bmp sensor


    So I'm basically making up a monitor for my 4x4 truck. I simply read some sensors and display them on various screens. So far I have written code and connected a map sensor, barometric pressure sensor and oil press sensor. All is well.

    I have 2 sensors left which are both k-type thermocouples. I'm using an old library (hopefully this isn't the prob) that uses SPI and I connect to the dedicated header pins for MISO, SCK and power. I set a CS pin per thermocouple.

    So... I have only attached one, but upon upload I get my gauges (thermister readings) showing values but they don't update in real time. If I switch screens and come back it will have updated or I'll see it change in a split second to where it should be when I first arrive on the screen, but not whilst it sits on the screen with the gauge after. This seems to be some sort of interference as I can run this fine with just code for thermisters without the 4d code or screen and I see it fine in serial monitor.

    I add the following line to just the thermister code with serial monitor, it compiles, but I get jibberish with every 10 sec a correct reading somewhere in the middle

    genie.AttachEventHandler(myGenieEventHandler);

    I'm not super clued up on this stuff but maybe I'm missing something obvious? If not I'll perhaps try re-writing everything to do with the thermocouples. If that doesn't I'll try a new library.

    This is the library https://github.com/JChristensen/Thermocouple

    Seeing as this is the only problem I've had like this, maybe it is the library??

    Cheers!!



    Last edited by CaM; 29th November 2018, 06:02 PM.
Working...
X