mirror of
https://github.com/eclipse/upm.git
synced 2025-03-15 04:57:30 +03:00
grove.cxx: change lux formula used in GroveLight
Signed-off-by: Sarah Knepper <sarah.knepper@intel.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
parent
8504830c52
commit
6fa68db79f
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Author: Brendan Le Foll <brendan.le.foll@intel.com>
|
||||
* Contributions: Mihai Tudor Panu <mihai.t.panu@intel.com>
|
||||
* Contributions: Sarah Knepper <sarah.knepper@intel.com>
|
||||
* Copyright (c) 2014 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
@ -106,10 +107,10 @@ GroveLight::~GroveLight()
|
||||
|
||||
int GroveLight::value ()
|
||||
{
|
||||
// rough conversion to Lux
|
||||
int a = mraa_aio_read(m_aio);
|
||||
a = 10000/(((1023-a)*10/a)*15)^(4/3);
|
||||
return a;
|
||||
// rough conversion to lux, using formula from Grove Starter Kit booklet
|
||||
float a = (float) mraa_aio_read(m_aio);
|
||||
a = 10000.0/pow(((1023.0-a)*10.0/a)*15.0,4.0/3.0);
|
||||
return (int) round(a);
|
||||
}
|
||||
|
||||
float GroveLight::raw_value()
|
||||
|
Loading…
x
Reference in New Issue
Block a user