@@ -9,7 +9,7 @@ import OxygenConcentrationChart from '../../components/OxygenConcentrationChart/
99import CO2ConcentrationChart from '../../components/CO2ConcentrationChart/CO2ConcentrationChart' ;
1010import SpectroscopeChart from '../../components/SpectroscopeChart/SpectroscopeChart' ;
1111import MapTile from '../../components/MapTile/MapTile' ;
12- import { append , pathOr , assocPath , pipe } from 'ramda' ;
12+ import { append , pathOr , assocPath , pipe , takeLast } from 'ramda' ;
1313import { withStyles } from '@material-ui/core/styles' ;
1414import CanSatAppBar from '../../components/CanSatAppBar/CanSatAppBar' ;
1515import Paper from '@material-ui/core/Paper' ;
@@ -146,21 +146,20 @@ class Dashboard extends Component {
146146
147147 this . state . socket . on ( 'data updated' , ( data ) => {
148148 const {
149- messageId, numberOfSatellites, temperature, lat, lng, pressure, humidity, lightIntensity, altitude, co2, tvoc, oxygenConcetration , radioStrength, spectroscope
149+ messageId, numberOfSatellites, temperature, lat, lng, pressure, humidity, lightIntensity, altitude, co2, tvoc, oxygenConcentration , radioStrength, spectroscope
150150 } = data ;
151151 this . setState ( {
152152 messageId, numberOfSatellites,
153153 center : {
154154 lat, lng
155155 } ,
156- temperature : append ( temperature , this . state . temperature ) ,
157- pressure : append ( pressure , this . state . pressure ) ,
158- humidity : append ( humidity , this . state . humidity ) ,
159- lightIntensity : append ( lightIntensity , this . state . lightIntensity ) ,
160- altitude : append ( altitude , this . state . altitude ) ,
161- co2 : append ( processCO2 ( co2 ) , this . state . co2 ) ,
162- tvoc : append ( tvoc , this . state . tvoc ) ,
163- oxygenConcentration : append ( oxygenConcetration , this . state . oxygenConcentration ) ,
156+ temperature : takeLast ( this . state . config . temperature . maxShowedValues , append ( temperature , this . state . temperature ) ) ,
157+ pressure : takeLast ( this . state . config . pressure . maxShowedValues , append ( pressure , this . state . pressure ) ) ,
158+ humidity : takeLast ( this . state . config . humidity . maxShowedValues , append ( humidity , this . state . humidity ) ) ,
159+ lightIntensity : takeLast ( this . state . config . lightIntensity . maxShowedValues , append ( lightIntensity , this . state . lightIntensity ) ) ,
160+ altitude : takeLast ( this . state . config . altitude . maxShowedValues , append ( altitude , this . state . altitude ) ) ,
161+ co2 : takeLast ( this . state . config . co2 . maxShowedValues , append ( processCO2 ( co2 ) , this . state . co2 ) ) ,
162+ oxygenConcentration : takeLast ( this . state . config . oxygenConcentration . maxShowedValues , append ( oxygenConcentration , this . state . oxygenConcentration ) ) ,
164163 signal : processRadioStrength ( radioStrength ) ,
165164 spectroscope : processSpectroscope ( spectroscope , this . state . config . spectroscope ) ,
166165 } ) ;
@@ -193,7 +192,7 @@ class Dashboard extends Component {
193192
194193 render ( ) {
195194 const { classes } = this . props ;
196- console . log ( this . state ) ;
195+
197196 return (
198197 < div >
199198 < CanSatAppBar signal = { this . state . signal } >
0 commit comments