Subversion Repositories group.NITPanels

Rev

Rev 15 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 15 Rev 22
Line 81... Line 81...
81
        }
81
        }
82
 
82
 
83
        /*
83
        /*
84
         * Incrementally add the assignment number for the newest found device
84
         * Incrementally add the assignment number for the newest found device
85
         *  This should only happen once, so it can be changed later on
85
         *  This should only happen once, so it can be changed later on
86
         *  @TODO: Remember last assignment, and save it along side the serial number
86
         *  TODO: Remember last assignment, and save it along side the serial numberTODO In list
87
         *
-
 
88
         */
87
         */
89
        private int getNextDeviceAssignNumber(NITDevice newDevice) {
88
        private int getNextDeviceAssignNumber(NITDevice newDevice) {
90
            int counter = 1;
89
            int counter = 1;
91
            foreach (NITDevice device in this.devices) {
90
            foreach (NITDevice device in this.devices) {
92
                if (device.type == newDevice.type) {
91
                if (device.type == newDevice.type) {
Line 107... Line 106...
107
 
106
 
108
        public static byte clearBit(byte data, int bitNum) {
107
        public static byte clearBit(byte data, int bitNum) {
109
            return (byte)(data & ~(1 << bitNum));
108
            return (byte)(data & ~(1 << bitNum));
110
        }
109
        }
111
 
110
 
-
 
111
        public static float map_f(uint x, uint in_min, uint in_max, float out_min, float out_max) {
-
 
112
            float var = (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
-
 
113
            return var;
-
 
114
        }
-
 
115
 
-
 
116
        public static uint map_ui(uint x, uint in_min, uint in_max, uint out_min, uint out_max) {
-
 
117
            uint var = (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
-
 
118
            return var;
-
 
119
        }
-
 
120
 
112
    }
121
    }
113
}
122
}