Coder Social home page Coder Social logo

Comments (22)

GoogleCodeExporter avatar GoogleCodeExporter commented on June 29, 2024
 can you pls post libboblight.so too, so I can test it is on my box.

Just a hint: try for testing purposes /dev/ttyS0 instead of ttyUSB0, then you 
know if it's because ftdi.so

I am also at ihad board (denim), if you want to discuss further...

cheers
d

Original comment by [email protected] on 14 Feb 2012 at 10:09

from boblight.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 29, 2024
Hi,

I have test your tip, same problem.
I have attached the file.

Test it please.

I find this code in devicers232.cpp:

int64_t now = GetTimeUs();

This code gives me 0, if i try  int32_t now = GetTimeUs();
It gives me time's, bath the times are wrong.


Original comment by [email protected] on 14 Feb 2012 at 10:47

Attachments:

from boblight.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 29, 2024
My guess is CLOCK_MONOTONIC is not functioning.

Original comment by [email protected] on 15 Feb 2012 at 2:04

from boblight.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 29, 2024

Original comment by [email protected] on 15 Feb 2012 at 2:04

from boblight.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 29, 2024
OK, Can i change CLOCK_MONOTONIC to something else, so it's working ?

Original comment by [email protected] on 15 Feb 2012 at 8:47

from boblight.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 29, 2024
Try CLOCK_REALTIME

Original comment by [email protected] on 15 Feb 2012 at 4:35

from boblight.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 29, 2024
Try CLOCK_REALTIME

I have done that, bath no result.
It's like that int64_t is not working.

Original comment by [email protected] on 15 Feb 2012 at 4:42

from boblight.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 29, 2024
Are the values in the struct timespec correct?

Original comment by [email protected] on 15 Feb 2012 at 6:07

from boblight.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 29, 2024
What do you mean?

This is my code of timeutils.h

#ifndef TIMEUTILS
#define TIMEUTILS

#include "inclstdint.h"

#include <time.h>

inline int64_t GetTimeUs()
{
  struct timespec time;
  clock_gettime(CLOCK_MONOTONIC, &time);

  return ((int64_t)time.tv_sec * 1000000LL) + (int64_t)(time.tv_nsec + 500) / 1000LL;
}

template <class T> 
inline T GetTimeSec()
{
  return (T)GetTimeUs() / (T)1000000.0;
}

void USleep(int64_t usecs, volatile bool* stop = NULL);

#endif //TIMEUTILS

If i do a ErrorLog in devicers232.cpp.

bool CDeviceRS232::WriteOutput()
{
  //get the channel values from the clienshandler
  int64_t now = GetTimeUs();
  m_clients.FillChannels(m_channels, now, this);

  //put the values in 1 byte unsigned in the buffer
  for (int i = 0; i < m_channels.size(); i++)
  {
    int64_t output = Round64((double)m_channels[i].GetValue(now) * m_max);
    output = Clamp(output, 0, m_max);

    //Send errorlog for debug
    LogError("Now =$i",now); //////// - This gives me 0 on my  box, on ubuntu gives me the time.
    LogError("output Clamp =$f",output); ////// - a random number 6nrs or sometime 7nrs. and on ubuntu         gives me 0 when there is no connection with the client and a number when there is a connection on with a client.

    for (int j = 0; j < m_bytes; j++)
      m_buff[m_prefix.size() + i * m_bytes + j] = (output >> ((m_bytes - j - 1) * 8)) & 0xFF;

     //mbuff gives me altime 0.00000 or FFFFFF
  }

Original comment by [email protected] on 15 Feb 2012 at 6:33

from boblight.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 29, 2024
now and output are int64_t, this is how you print them to the log:

LogError("Now =%" PRIi64, now);
LogError("output Clamp =%" PRIi64, output);

Original comment by [email protected] on 15 Feb 2012 at 7:34

from boblight.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 29, 2024
Hi, Thanks for your tip.

I think i no where the problem come from.

int64_t output = (double)m_channels[i].GetValue(now) * m_max;
output = Clamp(output, 0, m_max);

With Clamp i get 255 and without Clamp i get 9223372034707292159, That's Wrong.
So the leds are 255 that's FFFFFF.

on Ubuntu i get without clamp 0.

I i manual change the output to 55 i changed my color.
Do you no where i can find a solution for this problem.
I think the problem come from device.cpp GetValue.

Greetz Martijn

Original comment by [email protected] on 16 Feb 2012 at 12:43

from boblight.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 29, 2024
I suggest you start tracing back to where it goes wrong, it could be something 
in the CChannel::GetValue function.

Original comment by [email protected] on 16 Feb 2012 at 10:14

from boblight.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 29, 2024
Al the output from m_speed gives me negative numbers.
On linux its good.

Original comment by [email protected] on 16 Feb 2012 at 10:16

from boblight.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 29, 2024
Hi Bob, 
I am trying to solve this issue too. 
GDB is running on 2 machines with boblightd  (X86  / MIPS) :

MIPS OUTPUT (wrong):
(After the 2nd check once m_lastupdate was correctly set, it come to check the 
speed, but it never goes there, on x86 it does)
Breakpoint 1, CChannel::GetValue (this=0x4516e8, time=100323097023) at 
device/device.cpp:60
60        if (m_lastupdate == -1)
(gdb)
57      float CChannel::GetValue(int64_t time)
(gdb)
60        if (m_lastupdate == -1)
(gdb)
66        if (m_speed == 100.0) //speed of 100.0 means max
(gdb) p m_speed
$2 = -4.45014772e-308
(gdb) n
72          float diff = m_wantedvalue - m_currentvalue; //difference between 
where we want to be, and where we are
(gdb) p m_speed
$3 = -4.45014772e-308
(gdb) printf "%f ",m_speed
-0.000000 (gdb)

m_speed is show at least negative (I hope GDB is working and showing correct 
output)

X86 OUTPUT (correct):

Breakpoint 2, CChannel::GetValue (this=0x807b9c0, time=96943026820) at 
device/device.cpp:58
58  {
(gdb) 
60    if (m_lastupdate == -1)
(gdb) 
66    if (m_speed == 100.0) //speed of 100.0 means max
(gdb) 
68      m_currentvalue = m_wantedvalue;
(gdb) p m_speed 
$9 = 100
(gdb) printf "%f ",m_speed 
100.000000 (gdb) 

on X86 it show correctly all. 

This happens with almost all float values like for m_currentvalue, 
m_wantedvalue etc. 

So I am not really a C++ expert, so this problem might be easy to resolve (I 
hope :)

Original comment by [email protected] on 16 Feb 2012 at 10:22

from boblight.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 29, 2024
Nope, no easy fix, and without a machine to reproduce it on I can't be of much 
help.

Original comment by [email protected] on 16 Feb 2012 at 11:45

from boblight.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 29, 2024
my assumption is, that there are problems with float on the mipsel machine.

if I add:
---
float CChannel::GetValue(int64_t time)
{
printf("%4.2f %4.2f %4.2f\n",m_speed  ,m_lastupdate  , m_currentvalue  );
---

I get -> nan 324234234 nan

Original comment by [email protected] on 17 Feb 2012 at 9:54

from boblight.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 29, 2024
Now the question is where are those values coming from.

Original comment by [email protected] on 17 Feb 2012 at 6:56

from boblight.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 29, 2024
[deleted comment]

from boblight.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 29, 2024
I just got boblightd working with my arm router TL-WR1043ND and openwrt, and I 
don't have any problems.

I noticed openwrt uses "-msoft-float" as a compilation option - and it says 
about it:

> If your target CPU does not have a Floating Point Unit (FPU) or a kernel FPU 
emulator, but you still wish to support floating point functions, then 
everything will need to be compiled with soft floating point support 
(-msoft-float)

So maybe you guys should try to compile boblight with "-msoft-float" and all 
this float problems "float" away? ;-)

Original comment by [email protected] on 8 Jul 2012 at 10:49

from boblight.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 29, 2024
That sounds reasonable, but afaik it requires a software float implementation 
from glibc or another library.

Original comment by [email protected] on 8 Jul 2012 at 12:29

from boblight.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 29, 2024
All fixed!

Original comment by [email protected] on 29 Mar 2013 at 7:41

from boblight.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 29, 2024
github.com/speedy1985

Original comment by [email protected] on 29 Mar 2013 at 7:42

from boblight.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.