if (__mouse_pressed)
return;
console.info("Updating...");
$http(load_values)
.then(function (response) {
var data = null;
try {
data = new DataView(response.data);
} catch (e) {
console.error(e);
return;
}
tower = floor = measure = 0;
for (var i = 0; i < ntowers * nfloors * nmeasures; i++) {
tower = Math.floor(i / (nfloors * nmeasures));
floor = Math.floor((i / (nmeasures)) % nfloors);
measure = i % nmeasures;
var measuretype = measures[measure].type;
var valueIndex = 12 + measure * 9 + ( floor * nmeasures * 9) + (tower * nfloors * nmeasures *9 );
var valueStatus = valueIndex + 8;
towers_measures[tower][floor][measure].value = data.getFloat64(valueIndex, true);
towers_measures[tower][floor][measure].status = data.getUint8(valueStatus, true) & 1;
towers_measures[tower][floor][measure].used = (data.getUint8(valueStatus, true) & 128) ? 1 : 0;
}
for ( var i = 1; i < ntowers; i++ ) {
var floor_switches_bits = towers_measures[i][0][pcs_switches_index].value;
var floor_alarms_bits = towers_measures[i][0][pcs_alarm_index].value;
var switches_status = [];
var alarms_status = [];
floor_switches_bits = floor_switches_bits >>> 2;
floor_alarms_bits = floor_alarms_bits >>> 2;
if ( floor_switches_bits != 0 )
tower_control.set_tower_status(i, 1);
else
tower_control.set_tower_status(i, 0);
for (var j = 0; j < 14; j++) {
switches_status[j] = floor_switches_bits & 1;
alarms_status[j] = floor_alarms_bits & 1;
floor_switches_bits = floor_switches_bits >>> 1;
floor_alarms_bits = floor_alarms_bits >>> 1;
if(switches_status[j] && alarms_status[j])
tower_control.set_FCM_status(i, j+1, "ON_ALARM");
else if(switches_status[j])
tower_control.set_FCM_status(i, j+1, "ON");
else if(alarms_status[j])
tower_control.set_FCM_status(i, j+1, "OFF_ALARM");
else
tower_control.set_FCM_status(i, j+1, "OFF");
}
}
$localStorage.tower_values = JSON.stringify(towers_measures);
}, function (error) {
// todo handle errors
});
}

Inside set_FCM_status I use set_nodemat_value and set_nodemat_rgb on few items (8x15)

I'm using AngularJS (call $http with some params) and HTML5 local storage to share this big array of data between browser's tabs.

To avoid hiccups so far I've avoided the update when the user pans the scene but even if the camera moves I have hiccups.