Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const verNum = 4;
- // Version number can be a float/string/integer/number/
- function _versionCheck() {
- var bool;
- if (verNum <= 3) {
- bool = 1;
- } else {
- bool = 0;
- }
- return bool;
- _versionLEDSwitch(LedStatusByteP, bool);//triger version based function
- UpdateLEDStatus();//trigger existing funtion
- }
- // _versionCheck();
- // This function takes in the version number to keep it private and checks if new code or old code will run
- function UpdateLEDStatus(LedStatusByteP) {
- if ((LedStatusByteP & 1) != 0) {
- $scope.show1 = true;
- } else {
- $scope.show1 = false;
- }
- if ((LedStatusByteP & 2) != 0) {
- $scope.show2 = true;
- } else {
- $scope.show2 = false;
- }
- if ((LedStatusByteP & 4) != 0) {
- $scope.show3 = true;
- } else {
- $scope.show3 = false;
- }
- }
- function _versionLEDSwitch(LedStatusByteP, bool) {
- if (bool == 1) {
- if ((LedStatusByteP & 8) != 0) {
- $scope.show4 = true;
- } else {
- $scope.show4 = false;
- }
- if ((LedStatusByteP & 8) == 0) {
- $scope.show5 = true;
- } else {
- $scope.show5 = false;
- }
- } else {
- // Code for new version goes here
- }
- }
Add Comment
Please, Sign In to add comment