@@ -108,8 +108,9 @@ function updateProfileTable()
108108 var slope = "" ;
109109 var color = "" ;
110110
111- var html = '<h3>Schedule Points</h3><div class="table-responsive" style="scroll: none"><table class="table table-striped">' ;
112- html += '<tr><th style="width: 50px">#</th><th>Target Time in ' + time_scale_long + '</th><th>Target Temperature in °' + temp_scale_display + '</th><th>Slope in °' + temp_scale_display + '/' + time_scale_slope + '</th><th></th></tr>' ;
111+ var html = '<h3>Schedule Points</h3><div class="table-responsive" style="scroll: none">'
112+ html += '<table class="table table-striped">' ;
113+ html += '<tr><th style="width: 50px">#</th><th>Step Duration in ' + time_scale_long + '</th><th>Step Time in ' + time_scale_long + '</th><th>Target Temperature in °' + temp_scale_display + '</th><th>Slope in °' + temp_scale_display + '/' + time_scale_slope + '</th><th></th></tr>' ;
113114
114115 for ( var i = 0 ; i < graph . profile . data . length ; i ++ )
115116 {
@@ -120,9 +121,10 @@ function updateProfileTable()
120121 if ( dps == 0 ) { slope = "right" ; color = "grey" ; }
121122
122123 html += '<tr><td><h4>' + ( i + 1 ) + '</h4></td>' ;
123- html += '<td><input type="text" class="form-control" id="profiletable-0-' + i + '" value="' + timeProfileFormatter ( graph . profile . data [ i ] [ 0 ] , true ) + '" style="width: 60px" /></td>' ;
124- html += '<td><input type="text" class="form-control" id="profiletable-1-' + i + '" value="' + graph . profile . data [ i ] [ 1 ] + '" style="width: 60px" /></td>' ;
125- html += '<td><div class="input-group"><span class="glyphicon glyphicon-circle-arrow-' + slope + ' input-group-addon ds-trend" style="background: ' + color + '"></span><input type="text" class="form-control ds-input" readonly value="' + formatDPS ( dps ) + '" style="width: 100px" /></div></td>' ;
124+ html += '<td><input type="' + ( i === 0 ? 'hidden' : 'text' ) + '" class="form-control" id="profiletable-duration-' + i + '" value="' + timeProfileFormatter ( i === 0 ? 0 : graph . profile . data [ i ] [ 0 ] - graph . profile . data [ i - 1 ] [ 0 ] , true ) + '" style="width: 60px" /></td>' ;
125+ html += '<td><input type="' + ( i === 0 ? 'hidden' : 'text' ) + '" class="form-control" id="profiletable-time-' + i + '" value="' + timeProfileFormatter ( graph . profile . data [ i ] [ 0 ] , true ) + '" style="width: 60px" /></td>' ;
126+ html += '<td><input type="text" class="form-control" id="profiletable-temperature-' + i + '" value="' + graph . profile . data [ i ] [ 1 ] + '" style="width: 60px" /></td>' ;
127+ html += '<td><div class="input-group"><span class="glyphicon glyphicon-circle-arrow-' + slope + ' input-group-addon ds-trend" style="background: ' + color + '"></span><input type="text" class="form-control ds-input" id="profiletable-slope-' + i + '" value="' + formatDPS ( dps ) + '" style="width: 100px" /></div></td>' ;
126128 html += '<td> </td></tr>' ;
127129 }
128130
@@ -136,46 +138,52 @@ function updateProfileTable()
136138 var id = $ ( this ) [ 0 ] . id ; //e.currentTarget.attributes.id
137139 var value = parseInt ( $ ( this ) [ 0 ] . value ) ;
138140 var fields = id . split ( "-" ) ;
139- var col = parseInt ( fields [ 1 ] ) ;
140141 var row = parseInt ( fields [ 2 ] ) ;
141142
142- if ( graph . profile . data . length > 0 ) {
143- if ( col == 0 ) {
144- graph . profile . data [ row ] [ col ] = timeProfileFormatter ( value , false ) ;
145- }
146- else {
147- graph . profile . data [ row ] [ col ] = value ;
143+ if ( fields [ 1 ] === 'time' ) {
144+ if ( graph . profile . data . length > 0 ) {
145+ graph . profile . data [ row ] [ 0 ] = timeProfileFormatter ( value , false ) ;
146+ }
147+ } else if ( fields [ 1 ] === 'temperature' ) {
148+ graph . profile . data [ row ] [ 1 ] = value ;
149+ } else if ( fields [ 1 ] === 'duration' ) {
150+ graph . profile . data [ row ] [ 0 ] = graph . profile . data [ row - 1 ] [ 0 ] + timeProfileFormatter ( value , false ) ;
151+ } else if ( fields [ 1 ] === 'slope' ) {
152+ console . log ( { value, formatted : formatDPS ( value , true ) , start_temp : graph . profile . data [ row - 1 ] [ 1 ] , end_temp : graph . profile . data [ row ] [ 1 ] , start_time : graph . profile . data [ row - 1 ] [ 0 ] } )
153+ graph . profile . data [ row ] [ 0 ] = ( graph . profile . data [ row ] [ 1 ] - graph . profile . data [ row - 1 ] [ 1 ] ) / formatDPS ( value , true ) + graph . profile . data [ row - 1 ] [ 0 ]
148154 }
149155
150156 graph . plot = $ . plot ( "#graph_container" , [ graph . profile , graph . live ] , getOptions ( ) ) ;
151- }
152- updateProfileTable ( ) ;
153157
158+ updateProfileTable ( ) ;
154159 } ) ;
155160}
156161
157162function timeProfileFormatter ( val , down ) {
158163 var rval = val
159164 switch ( time_scale_profile ) {
160165 case "m" :
161- if ( down ) { rval = val / 60 ; } else { rval = val * 60 ; }
166+ rval = down ? val / 60 : val * 60 ;
162167 break ;
163168 case "h" :
164- if ( down ) { rval = val / 3600 ; } else { rval = val * 3600 ; }
169+ rval = down ? val / 3600 : val * 3600 ;
165170 break ;
166171 }
167172 return Math . round ( rval ) ;
168173}
169174
170- function formatDPS ( val ) {
175+ function formatDPS ( val , down = false ) {
171176 var tval = val ;
172- if ( time_scale_slope == "m" ) {
173- tval = val * 60 ;
174- }
175- if ( time_scale_slope == "h" ) {
176- tval = ( val * 60 ) * 60 ;
177+ switch ( time_scale_slope ) {
178+ case "m" :
179+ tval = down ? val / 60 : val * 60 ;
180+ break ;
181+ case "h" :
182+ tval = down ? val / 60 / 60 : ( val * 60 ) * 60 ;
183+ break ;
177184 }
178- return Math . round ( tval ) ;
185+
186+ return down ? tval : Math . round ( tval ) ;
179187}
180188
181189function hazardTemp ( ) {
0 commit comments