made changes in start and stop

master
varun 2 years ago
parent b787c96327
commit d98e69aae0

@ -273,7 +273,7 @@ exports.motorAction = async (req, reply) => {
if(action === "start"){ if(action === "start"){
const start_time = new Date().toLocaleString('en-US', {timeZone: 'Asia/Kolkata'}) const start_time = new Date().toLocaleString('en-US', {timeZone: 'Asia/Kolkata'})
const stop_at = req.body.stop_at // const stop_at = req.body.stop_at
@ -314,7 +314,7 @@ exports.motorAction = async (req, reply) => {
const supplier_capacity = parseInt(supplier_tank_info.capacity.replace(/,/g, ''), 10) const supplier_capacity = parseInt(supplier_tank_info.capacity.replace(/,/g, ''), 10)
console.log((newSupplierWaterLevel/supplier_capacity)*100) console.log((newSupplierWaterLevel/supplier_capacity)*100)
// Check if updating should stop // Check if updating should stop
if ((newSupplierWaterLevel/supplier_capacity)*100 <= stop_at || (newWaterLevel/receiver_capacity)*100 >= 95 || (newWaterLevel/receiver_capacity)*100 >= desired_water_percentage || rcvr_info.motor_status === "0") { if ((newSupplierWaterLevel/supplier_capacity)*100 <= 5 || (newWaterLevel/receiver_capacity)*100 >= 95 || (newWaterLevel/receiver_capacity)*100 >= desired_water_percentage || rcvr_info.motor_status === "0") {
clearInterval(intervals[interval_variable]); // Clear the interval for this tank clearInterval(intervals[interval_variable]); // Clear the interval for this tank
delete intervals[interval_variable]; delete intervals[interval_variable];
sum_oh_count--; sum_oh_count--;
@ -437,7 +437,7 @@ exports.motorAction = async (req, reply) => {
const newWaterLevel = receiver_waterlevel + 250//Math.floor(supplier_waterlevel * 0.1); const newWaterLevel = receiver_waterlevel + 250//Math.floor(supplier_waterlevel * 0.1);
const newSupplierWaterLevel = Math.min(supplier_capacity, supplier_waterlevel - 250);// Math.floor(supplier_waterlevel * 0.15)); const newSupplierWaterLevel = Math.min(supplier_capacity, supplier_waterlevel - 250);// Math.floor(supplier_waterlevel * 0.15));
// Check if updating should stop // Check if updating should stop
if ((newWaterLevel/receiver_capacity)*100 >= 97 || (newWaterLevel/receiver_capacity)*100 >= desired_water_percentage || rcvr_info.motor_status === "0" || (newSupplierWaterLevel/supplier_capacity)*100 <= stop_at ) { if ((newWaterLevel/receiver_capacity)*100 >= 97 || (newWaterLevel/receiver_capacity)*100 >= desired_water_percentage || rcvr_info.motor_status === "0" || (newSupplierWaterLevel/supplier_capacity)*100 <= 5 ) {
clearInterval(intervals[interval_variable]); // Clear the interval for this tank clearInterval(intervals[interval_variable]); // Clear the interval for this tank
delete intervals[interval_variable]; delete intervals[interval_variable];

Loading…
Cancel
Save