Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. Spacecraft.prototype.updateState = function () {
  2. var timestamp = Date.now();
  3. var self = this;
  4.  
  5. sql = util.format(
  6. "SELECT `timestamp`, `obsw_timestamp`, `gps_satellite_count`, `gps_altitude`, `gps_altitude_measure_unit`, `gps_latitude`, `gps_latitude_hemisphere`, `gps_longitude`, `gps_longitude_hemisphere`, `gps_timestamp`, `si1145_ambient_light`, `si1145_ir_index`, `si1145_uv_index`, `htu21d_humidity`, `htu21d_temperature`, `guva_uv_index`, `mpu_temperature`, `mpu_acceleration_X`, `mpu_acceleration_Y`, `mpu_acceleration_Z`, `mpu_gyro_X`, `mpu_gyro_Y`, `mpu_gyro_Z`, `mpu_magnetic_field_X`, `mpu_magnetic_field_Y`, `mpu_magnetic_field_Z`, `ms5611_altitude`, `ms5611_pressure`, `ms5611_temperature` FROM %s where timestamp > '%s'",
  7. self.tablename,
  8. datetime.create(timestamp).format("Y-m-d H:M:S"))
  9.  
  10. console.log(sql);
  11.  
  12. self.con.query(sql, function (err, result) {
  13. if (err) throw err;
  14. console.log("Result: " + JSON.stringify(result, null, 4));
  15.  
  16. self.state["prop.temp"] = result[0]["mpu_temperature"];
  17. });
  18. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement