A_God

CHemck

Mar 30th, 2022 (edited)
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const verNum = 4;
  2. // Version number can be a float/string/integer/number/
  3.  
  4. function _versionCheck() {
  5.     var bool;
  6.     if (verNum <= 3) {
  7.         bool = 1;
  8.  
  9.     } else {
  10.         bool = 0;
  11.     }
  12.     return bool;
  13.     _versionLEDSwitch(LedStatusByteP, bool);//triger version based function
  14.     UpdateLEDStatus();//trigger existing funtion
  15. }
  16. // _versionCheck();
  17. // This function takes in the version number to keep it private and checks if new code or old code will run
  18.  
  19. function UpdateLEDStatus(LedStatusByteP) {
  20.     if ((LedStatusByteP & 1) != 0) {
  21.         $scope.show1 = true;
  22.     } else {
  23.         $scope.show1 = false;
  24.     }
  25.     if ((LedStatusByteP & 2) != 0) {
  26.         $scope.show2 = true;
  27.     } else {
  28.         $scope.show2 = false;
  29.     }
  30.     if ((LedStatusByteP & 4) != 0) {
  31.         $scope.show3 = true;
  32.     } else {
  33.         $scope.show3 = false;
  34.     }
  35.  
  36.  
  37. }
  38.  
  39. function _versionLEDSwitch(LedStatusByteP, bool) {
  40.  
  41.     if (bool == 1) {
  42.         if ((LedStatusByteP & 8) != 0) {
  43.             $scope.show4 = true;
  44.         } else {
  45.             $scope.show4 = false;
  46.         }
  47.         if ((LedStatusByteP & 8) == 0) {
  48.             $scope.show5 = true;
  49.         } else {
  50.             $scope.show5 = false;
  51.         }
  52.     } else {
  53.         // Code for new version goes here
  54.     }
  55.  
  56.  
  57. }
Add Comment
Please, Sign In to add comment