public static bool sendSinglePulse(int channel_number, int pulse_width, int pulse_current) { if (channel_number == 0) { return(false); } byte[] command = SinglePulse.getCommand(channel_number, pulse_width, pulse_current); RehaStimInterface.sendMessage(command); return(true); }
public static bool sendSinglePulse(Channels channel_number, int pulse_width, int pulse_current) { if (channel_number == Channels.ChannelNone) { return(false); } byte[] command = SinglePulse.getCommand((int)channel_number, pulse_width, pulse_current); RehaStimInterface.sendMessage(command); return(true); Debug.Log("single pulse more channel"); }
public static bool UpdateChannel(Channels channelNumber, UpdateInfo info, bool sendMessage = true) { if (!currentConfig.ContainsKey((int)channelNumber)) { return(false); } currentConfig.Remove((int)channelNumber); currentConfig.Add((int)channelNumber, info); if (sendMessage) { List <UpdateInfo> infos = new List <UpdateInfo>(currentConfig.Values); byte[] cmd = ChannelList.GetUpdateCommand(infos); RehaStimInterface.sendMessage(cmd); } return(true); }
public static void InitCM(int nFactor, ChannelMask channelsStim, ChannelMask channelsLowFreq, int groupFrequency, int mainFrequency, int maxPulseGroup = 1) { // save config lastConfig = new channelListConfig(); lastConfig.nFactor = nFactor; lastConfig.channelsStim = channelsStim; lastConfig.channelsLowFreq = channelsLowFreq; lastConfig.groupFrequency = groupFrequency; lastConfig.mainFrequency = mainFrequency; lastConfig.maxPulseGroup = maxPulseGroup; int groupTime = ChannelList.HerzToGroupTime(groupFrequency); //groupTime needs to be at least max (#channels,#lowFreq) * 1.5 int minGroupTime = (int)Mathf.Ceil( Mathf.Max(channelsStim.getActiveChannels().Count , channelsLowFreq.getActiveChannels().Count) * 1.5f ); groupTime = Mathf.Max(groupTime, minGroupTime); int mainTime = ChannelList.HerzToMainTime(mainFrequency); //mainTime needs to be at least pusleGroupSize * groupTime + 1.5ms int minMainTime = (int)Mathf.Ceil(maxPulseGroup * groupTime + 1.5f); mainTime = Mathf.Max(mainTime, minMainTime); //Debug.Log(mainTime + "|" + groupTime); byte[] cmd = ChannelList.GetInitCommand(nFactor, channelsStim.toInt(), channelsLowFreq.toInt(), groupTime, mainTime); RehaStimInterface.sendMessage(cmd); //ChannelList.activeChannels = channelsStim; //ChannelList.activeChannelsLowFreq = channelsLowFreq; currentConfig = new SortedDictionary <int, UpdateInfo>(); //init config foreach (var channel in channelsStim.getActiveChannels()) { currentConfig.Add(channel, new UpdateInfo(UpdateInfo.MODE_SINGLE, 0, 0)); } isRunning = true; }
//private void OnDisable() //{ // ChannelList.Stop(); //} public static void Stop() { byte[] cmd = ChannelList.GetStopCommand(); RehaStimInterface.sendMessage(cmd); isRunning = false; }
public static int maxPulseWidth = 400; // the default maximum pulse_width in microseconds // Use this for initialization public void Start() { Debug.Log("RehaStimInterface.cs started"); instance = this; init(); }
public static int maxPulseWidth = 400; // the default maximum pulse_width in microseconds // Use this for initialization public void Start() { instance = this; init(); }