Menu

PPMOut Pause Period Problem

Features
Anonymous
2015-06-01
2015-06-02
  • Anonymous

    Anonymous - 2015-06-01

    Hello, I tried ppmout_example as is, its compile without problem on Arduino 1.0.6
    But when I check the output using ossiloscope the pause period in the end of ppm signal doesnt has constant length. It shrink down until like theres no pause period and back to normal and so forth like this
    1-1-1-1-1--------1-1-1-1-1
    1-1-1-1-1-------1-1-1-1-1
    1-1-1-1-1------1-1-1-1-1
    1-1-1-1-1-----1-1-1-1-1
    1-1-1-1-1----1-1-1-1-1
    1-1-1-1-1---1-1-1-1-1
    1-1-1-1-1--1-1-1-1-1
    1-1-1-1-1---------1-1-1-1-1
    1-1-1-1-1--------1-1-1-1-1
    My RC decoder is homebrew and use analog circuit, so its need predetermined pause period to function. Thanks

     
    • dvdouden

      dvdouden - 2015-06-01

      Please see this ticket, it may be related:
      https://sourceforge.net/p/arduinorclib/tickets/57/

      In PPMOut.h, replace the define of PPM_OUT_WORK_SIZE with this:

      #define PPMOUT_WORK_SIZE(channels) (((channels) + ((channels) + 1) * 2) * sizeof(uint16_t))
      

      In PPMOut.cpp, add a comma to the first line of this snippet and add the following two lines after it:

      m_timings(const_cast<uint16_t*>(m_channelTimings) + p_maxChannels),
      m_mask(0),
      m_port(0)
      
       
  • Anonymous

    Anonymous - 2015-06-01

    Thank you the problem is now less severe, the pulse still go back and forth but now plenty of pause period for my decoder to function correctly. Im really new to programming so i cant help about the ticket. You might want to make the total work size constant say 20 ms, so the pause pulse will be varied depending on how many channel activated

     
  • Anonymous

    Anonymous - 2015-06-01

    Sorry my bad, i just click the link to the thread about fixed work size

     
    • dvdouden

      dvdouden - 2015-06-01

      I didn't read your question properly the first time. First of all, there's a bug in PPMOut which I never got around to fix. The first snippets of code I posted earlier will fix that bug so PPMOut is more or less stable and has a fixed frame width.

      If you need a fixed pause period, find the updateTimings function in PPMOut.cpp and replace it with the following:

      void PPMOut::updateTimings()
      {
          uint16_t* scratch = m_timings;
          uint16_t pause = m_pauseLength;
          // copy all pre-calculated timings
          for (uint8_t i = 0; i < m_channelCount; ++i)
          {
              // set pulse length
              *scratch = m_pulseLength;
              ++scratch;
              // set timing
              *scratch = m_channelTimings[i] - m_pulseLength;
              pause -= m_channelTimings[i];
              ++scratch;
          }
          // set final pulse length
          *scratch = m_pulseLength;
          ++scratch;
          // set pause length
          *scratch = pause - m_pulseLength;
          // update number of timings
          m_timingCount = (m_channelCount + 1) * 2;
      }
      

      That should give you a fixed pause length.

       
  • Anonymous

    Anonymous - 2015-06-01

    The first code you post is quite enough, thanks anyway

     

    Last edit: dvdouden 2015-06-02

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.