Open Amerlander opened 4 months ago
@joernalraun can you specify what blocks we need?
Views of motor block:
Views of MotionKit block (should show MotionKit instead of Motor):
@haithembelhaj as we cannot offer the MakeCode user add-on option for the labels, would it be possible to also add the previous two blocks at the end of all Calliope mini blocks for motors/cars? When everything else is done and there is still time/fun to do so? ;)
@haithembelhaj We created a HEX file today for the Motors: https://github.com/calliope-edu/pxt-calliope/commit/0aa93688d94b1c8562cc876d3206bdee92fc703a
Calliope-More-Motors.zip (C17 is also included now)
It listens on data[0] >> 5
== MbitMoreCommand::CMD_MOTOR
| 0x06
It then awaits in data[0] & 0b11111
either of:
SET_M0
| 0x01
// First MotorSET_M1
| 0x02
// Second MotorSET_M0_M1
| 0x03
// Both Motors, set same direction and speed for bothWith values for direction and speed in:
data[1]
= Direction: 0
| 1
data[2]
= Speed: 0 - 1001
for "backwards" and 0
for "fowards"
Could be implemented in JS somehow like
unserInput = -50
direction = (unserInput < 0) ? 1 : 0
speed = Math.abs(unserInput)
The MakeCode implementation of the makecode blocks is here for refference: https://github.com/microsoft/pxt-calliope/blob/03e928aec8b7ac2f34738c95f8e8e75a0fa40bcc/libs/core-mini-codal/motors.ts#L45 Note, that we do not need the mapping, since it is different for DAL and CODAL. So the mapping is done in the HEX. But we always expect positive values from 0 to 100 for the speed.
@Amerlander I added the block following the specs but without success sadly :( https://github.com/calliope-edu/scratch-vm/commit/c7c4f5b41432084e5c8fefcaae8e6fcd092bd94e I'm I doing something wrong?
Your code locks fine. I'll check if there is something going wrong with the hex file.
The Motor should be part of the first command. I changed it in scsratch-vm: https://github.com/calliope-edu/scratch-vm/commit/1aab934d631ad43e5eb1195d482c64b1ef3786d8 @haithembelhaj Can you have a look?
There was an issue in the hex file too. It now works with the changes from above and this new hex file:
amazing! I updated the VM by removing the logs :)
If you only updated the VM you could just re-run the Job by opening the last job and click on the re-run-button on the top right: https://github.com/calliope-edu/scratch-gui/actions/runs/8942832422
That should rebuild the page with the current vm without having to commit to the gui repo.
Right now the block is english, can this be translated as well and we need motor in it "set motor"... In German it should be "setze Motor XX auf XX".
@joernalraun translated and deployed :)
We plan to have motor blocks for the Motor Board and for the Motion kit.
Current implementation in HEX File:
data[0]
data[1]
anddata[2]