NewRemote now accepts delay param

getters clear dirty params sync enabled.

examples and tests updated
This commit is contained in:
onyx-and-iris
2022-09-14 16:05:15 +01:00
parent a4b84f289e
commit 8ca545b1c4
7 changed files with 41 additions and 57 deletions

15
base.go
View File

@@ -151,6 +151,11 @@ func getVMType() (string, error) {
// getParameterFloat gets the value of a float parameter
func getParameterFloat(name string) (float64, error) {
if vmsync {
time.Sleep(time.Duration(vmdelay) * time.Millisecond)
for pdirty() || mdirty() {
}
}
var value float32
b := append([]byte(name), 0)
res, _, _ := vmGetParamFloat.Call(
@@ -181,6 +186,11 @@ func setParameterFloat(name string, value float64) error {
// getParameterString gets the value of a string parameter
func getParameterString(name string) (string, error) {
if vmsync {
time.Sleep(time.Duration(vmdelay) * time.Millisecond)
for pdirty() || mdirty() {
}
}
b1 := append([]byte(name), 0)
var b2 [512]byte
res, _, _ := vmGetParamString.Call(
@@ -225,6 +235,11 @@ func setParametersMulti(script string) error {
// getMacroStatus gets a macrobutton value
func getMacroStatus(id, mode int) (float64, error) {
if vmsync {
time.Sleep(time.Duration(vmdelay) * time.Millisecond)
for pdirty() || mdirty() {
}
}
var state float32
res, _, _ := vmGetMacroStatus.Call(
uintptr(id),