diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index 718c23ce..46177ddc 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -273,7 +273,7 @@ exports.motorAction = async (req, reply) => { if(action === "start"){ 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) console.log((newSupplierWaterLevel/supplier_capacity)*100) // 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 delete intervals[interval_variable]; sum_oh_count--; @@ -437,7 +437,7 @@ exports.motorAction = async (req, reply) => { 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)); // 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 delete intervals[interval_variable];