本文整理汇总了Python中state.State.printT方法的典型用法代码示例。如果您正苦于以下问题:Python State.printT方法的具体用法?Python State.printT怎么用?Python State.printT使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类state.State
的用法示例。
在下文中一共展示了State.printT方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tone
# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import printT [as 别名]
def tone(self,who,val,unused=None,force=False):
# who is 'M','A','B','C','D','TR'
if force or val != self.preset.currentDict[who][1]:
State.printT('TONE:\t' + str(who) +'\t' + str(val))
trVal = 'Off'
toneVal = '0'
if who =='TR':
trVal = str(val-1) if val else 'Off'
targ = 'M'
toneVal = None
elif who == 'M':
targ = who
trVal = None
toneVal = str(val-1) if val else 'Off'
self.mEval.set(1,val)
else:
targ = who
trVal = '0' if val else 'Off'
toneVal = str(val-1) if val else 'Off'
if trVal != None:
#self.outgoing.append("a.set('%s',State.ToneRange,State.l%s)"%(targ,trVal))
self.set(targ,State.ToneRange,eval('State.l%s'%trVal))
if toneVal != None:
#self.outgoing.append("a.set('%s',State.Tone,State.l%s)"%(targ,toneVal))
self.set(targ,State.Tone,eval('State.l%s'%toneVal))
self.preset.currentDict[who][1] = val
return True
return False
示例2: update
# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import printT [as 别名]
def update(self,name, att, state=State.connectionUpdateOnly):
""" To call update(...) on name, att, state
>>> update('A',State.Inverter,State.l2)
To call update(...) on connections
>>> update(('A',0),('B',1))
this method sets up the call to doSettingMasking
which makes the member variable assignments
---
Note that there is a procedural difference between updating
a Vol, Tone,ToneRang, Inverter setting, and updating a connection
setting.
In the former case, the non-affecting attributes are maintained.
In the latter case, all the connection settings are reset prior to
updating. Examples:
If we had 'A', Vol, l3 already, then we set 'A', Inverter, 1, then
both the vol and inverter settings are maintained.
But if we have some connections and we add are starting a new one then
the previous ones are erased. However, if we have already started
adding connections, then the previous NEW ones are maintained.
"""
if state == State.connectionUpdateOnly:
self.doSettingMasking(connectionsDict[(name,att)],[])
else:
# all states can be 'State.lOff', ie None !
onOff = not state == State.lOff
(setting, masking) = BitMgr.baseFunc(onOff,
name,
att,
state)
State.printT(setting,masking) # this is ok!
# for a.set('A',State.Inverter,State.l0)
# ((4, 0), (4, 3)) ((4, 240),)
self.doSettingMasking(setting,masking)
示例3: pb0Func
# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import printT [as 别名]
def pb0Func(self):
if self.sequencing:
State.printT('pb0Func:\tstepping the sequence...')
#State.debug and input('Press Return:')
return self.doNextSeq()
else:
return false
示例4: loadConf
# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import printT [as 别名]
def loadConf(self, conf):
try:
#res = self.doParse(conf[self.conf.vocab.configKeys[7]])
self.doParse(conf[self.conf.vocab.configKeys[7]])
"""
for e in res:
#print(e)
self.outgoing.append(e)
"""
for key in self.preset.currentDict.keys():
self.preset.currentDict[key] = conf[key]
except Exception as e:
print (e)
self.doParse(self.conf.presetConf.defaultConfDict[self.conf.vocab.configKeys[7]])
for key in self.conf.presetConf.defaultConfDict.keys():
self.preset.currentDict[key] = self.conf.presetConf.defaultConfDict[key]
self.preset.currentDict[self.conf.vocab.configKeys[0]] = 'DEFAULT PRESET'
self.tone('TR',self.preset.currentDict['TR'][1],force=True)
for c in ['A','B','C','D','M']:
self.vol(c,self.preset.currentDict[c][0],force=True)
self.tone(c,self.preset.currentDict[c][1],force=True)
self.lcdMgr.loadConf()
self.trem(self.preset.currentDict[self.conf.vocab.configKeys[8]])
self.vib(self.preset.currentDict[self.conf.vocab.configKeys[9]])
self.tracking(self.preset.currentDict[self.conf.vocab.configKeys[10]])
State.printT(self.outgoing)
示例5: doConfHelper
# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import printT [as 别名]
def doConfHelper(self,cf):
return True
# TO BE FIXED
self.reset()
State.printT('loading conf: ' + str(cf))
self.loadConf(self.preset.presets[cf])
return True
示例6: off
# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import printT [as 别名]
def off(self,whatIndex,on):
"""
turn on or off the control given by the whatIindex
"""
self.aVec[whatIndex] = on
if self.aVec[whatIndex]:
self.ctrl.doInit()
State.printT( ('Vibrato' if whatIndex else 'Tremolo')+':\t' + str(self.aVec[whatIndex]))
示例7: doTrem
# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import printT [as 别名]
def doTrem(self):
if not self.aVec[0]:
return
State.printT('Tremolo Level:\t',self.tremoloLevel)
#print('Push: M Vol %s'%self.vVec[self.tremoloLevel])
irq_state = disable_irq()
self.volEnQueueable.push(self.targCoilID,self.vVec[self.tremoloLevel])
enable_irq(irq_state)
self.tremoloLevel ^= 1
示例8: doVib
# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import printT [as 别名]
def doVib(self):
if not self.aVec[1]:
return
State.printT('Vibrato Level:\t',self.vibratoLevel)
#print('Push: M Tone %s'%self.tVec[self.vibratoLevel])
irq_state = disable_irq()
self.toneEnQueueable.push(self.targCoilID,self.tVec[self.vibratoLevel])
enable_irq(irq_state)
self.vibratoLevel ^= 1
示例9: pb0Func
# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import printT [as 别名]
def pb0Func(self):
if self.sequencing:
State.printT('pb0Func:\tstepping the sequence...')
#State.debug and input('Press Return:')
return self.doNextSeq()
else:
return False # tracking disabled
State.printT('pb0Func:\ttoggling tracking...')
#State.debug and input('Press Return:')
return self.toggleTracking()
示例10: printConfigs
# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import printT [as 别名]
def printConfigs(self,setting,masking):
"""
A little helper routing to print setting and masking to stdout for
user information.
To print only the config vectors, call:
>>> b.printConfigs(None, [])
"""
for (reg,mask) in masking:
State.printT("masking: ",
["{0:d}".format(reg), "{0:08b}".format(mask)])
State.printT('setting: ' + str(setting))
示例11: update
# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import printT [as 别名]
def update(self,bitArray):
# send the data bits to the shift register
# unset the latch
self.stcp.low()
# send the bits
for r in bitArray:
self.spi.send(r)
#### COMMENT NEXT LINE FOR Off-Board TESTS!
State.printT("send:\t{0:#b}".format(r))
# turn on the latch
self.stcp.high()
示例12: vol
# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import printT [as 别名]
def vol(self,who,val,unused=None,force=False):
# who is 'M','A','B','C','D'
if force or val != self.preset.currentDict[who][0]:
State.printT('VOL:\t' + str(who) +'\t' + str(val))
#print("a.set('%s',State.Vol,State.l%s)"%(who,(str(val) if val !=0 else 'Off')))
#self.outgoing.append("a.set('%s',State.Vol,State.l%s)"%(who,(str(val)))) # if val !=0 else 'Off')))
self.set(who,State.Vol,eval('State.l%s'%str(val)))
self.preset.currentDict[who][0] = val
if who == 'M':
self.mEval.set(0,val)
return True
return False
示例13: doInit
# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import printT [as 别名]
def doInit(self, loopDelay=5):
"""
sets the base value so that gravity is cancelled out from the initial postion
loopDelay is the time in ms between attempts to read the accelerometer.
"""
self.baseVal=0
init=False
while not init:
delay(loopDelay)
init,self.baseVal = self.readA()
self.lastActionTime = millis()
State.printT('Initialized!')
示例14: pb
# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import printT [as 别名]
def pb(self,who,unused=None,unusedA=None):
if ((pyb.millis() - self.pbTime) < State.pbBounceDelay):
self.pbTime = pyb.millis()
State.printT('PB BOUNCE!! delta millis:\t' + str(pyb.millis() - self.pbTime))
return False
State.printT('PB delta millis:\t' + str(pyb.millis() - self.pbTime))
self.pbTime = pyb.millis()
whoFuncs = (
# this either steps the seq or toggles splitpot tracking if not sequencing
(self.pb0Func,), # pb 0 # either step sequence or toggle tracking if not sequencing
# this is the one saves the preset,
(self.turnOnYellowLed, self.saveCurrentConfAsPreset), # pb 1
# Tremolo
(self.toggleTrem,), # pb 2
# Vibrato
(self.toggleVib,), # pb 3
(self.lcdMgr.onLeftButton,), # pb 4
(self.lcdMgr.onRightButton,)) # pb 5
State.printT('PB:\t' + str(who))
res = False
for f in whoFuncs[who]:
res = f() or res
State.printT('pb returning: ' +str(res))
return res # True if who in [2,3] else False
示例15: doWork
# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import printT [as 别名]
def doWork(self,twoBytes):
V = twoBytes & 0xFF
K = (twoBytes>>8) & 0xFF
mask = 0x80
res = False
State.printT('Work:\tK:\t' + bin(K) + '\tV:\t'+ hex(V))
#print('X:\tK:\t' + bin(K) + '\tV:\t'+ hex(V))
for i in range(5):
if K & (mask>>i):
who = App.targVec[min(i,3)][K & 0b111]
val = (0xFF & V) if (V & 0xFF)<128 else (V & 0XFF)-256
res = self.setVec[i](who,val,K&0B11111000) or res
break
return res