Iβm not an expert and just started playing around with macros, but my understanding is that you need to use the releaseKey in your macro to complete the first activation and deactivation of the scan code and the second pressKey will activate it again. Otherwise you are activating an already activated scan code.
This macro works as you described, triggering a βMβ when holding and another when releasing:
pressKey M
delayUntilRelease
releaseKey M
press Key M
ifSecondary final suppressMods holdKey LC-space
suppressMods tapKey LCLS-m
ifNotShift break
delayUntil 600
suppressMods tapKey LCLS-semicolonAndColon // CS-o on Colemak host
Also be aware that I have configured my secondary settings for advanced strategy and a timeout. The above macro uses this to trigger push-to-talk when you press and hold the button for longer than the advanced.timeout.
In $onInit:
...
set secondaryRole.defaultStrategy advanced
set secondaryRole.advanced.timeout 250
set secondaryRole.advanced.timeoutAction secondary
set secondaryRole.advanced.triggerByRelease 1
...
Oh, and BTW, LC-space is the built-in push-to-talk functionality in Teams. You donβt need to press LCLS-m twice. Just hold LC-space while you speak. My macro just maps everything onto one single key:
hold for push-to-talk
tap to mute or unmute
shift-tap to mute/unmute AND turn the camera on/off