How to use the minimalmodbus._checkInt function in minimalmodbus

To help you get started, we’ve selected a few minimalmodbus examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pyhys / minimalmodbus / test / test_minimalmodbus.py View on Github external
def testKnownValues(self):
        minimalmodbus._checkInt(47, minvalue=None,  maxvalue=None, description='ABC')
        minimalmodbus._checkInt(47, minvalue=40,    maxvalue=50, description='ABC')
        minimalmodbus._checkInt(47, minvalue=-40,   maxvalue=50, description='ABC')
        minimalmodbus._checkInt(47, description='ABC', maxvalue=50, minvalue=40)
        minimalmodbus._checkInt(47, minvalue=None,  maxvalue=50, description='ABC')
        minimalmodbus._checkInt(47, minvalue=40,     maxvalue=None, description='ABC')
github pyhys / minimalmodbus / omegacn7500.py View on Github external
def set_pattern_link_topattern(self, patternnumber, value):
        """Set the 'linked pattern' value for a given pattern.

        Args:
            * patternnumber (integer): 0-7
            * value (integer): 0-8. A value=8 sets the link parameter to OFF.
        """
        _checkPatternNumber(patternnumber)
        minimalmodbus._checkInt(value, minvalue=0, maxvalue=8, description='linked pattern value') 
        
        address = _calculateRegisterAddress('linkpattern', patternnumber)
        self.write_register(address, value, 0)
github pyhys / minimalmodbus / omegacn7500.py View on Github external
def _checkStepNumber( stepnumber ):
    """Check that the given  stepumber is valid.
    
    Args:
        * stepnumber (int): The stepnumber to be checked.
        
    Raises:
        TypeError, ValueError
    
    """
    minimalmodbus._checkInt(stepnumber, minvalue=0, maxvalue=7, description='step number') 
github pyhys / minimalmodbus / omegacn7500.py View on Github external
def _checkPatternNumber( patternnumber ):
    """Check that the given patternnumber is valid.
    
    Args:
        * patternnumber (int): The patternnumber to be checked.
        
    Raises:
        TypeError, ValueError
    
    """
    minimalmodbus._checkInt(patternnumber, minvalue=0, maxvalue=7, description='pattern number') 
github pyhys / minimalmodbus / omegacn7500.py View on Github external
def set_control_mode(self, modevalue):
        """Set the control method using the corresponding integer value.
                
        Args:
            modevalue(int): 0-3
            
        The modevalue is one of the keys in :data:`CONTROL_MODES`.    
        """
        minimalmodbus._checkInt(modevalue, minvalue=0, maxvalue=3, description='control mode') 
        self.write_register(4101, modevalue)
github pyhys / minimalmodbus / omegacn7500.py View on Github external
def set_pattern_additional_cycles(self, patternnumber, value):
        """Set the number of additional cycles for a given pattern.

        Args:
            * patternnumber (integer): 0-7
            * value (integer): 0-99
        """
        _checkPatternNumber(patternnumber)
        minimalmodbus._checkInt(value, minvalue=0, maxvalue=99, description='number of additional cycles') 
            
        address = _calculateRegisterAddress('cycles', patternnumber)
        self.write_register(address, value, 0)