Comments (15)
from pxt-ev3.
Looks like we should mock this line
let conns = analogMM.slice(AnalogOff.InConn, DAL.NUM_INPUTS)
When an device api gets called, it should register itself in the InConn array so that it becomes visible to the simulator. This might need to be an Async operation where you have to wait that the device gets detected on first use.
from pxt-ev3.
I'll keep digging, but Peli like I said, in order for that method (analogMM.slice) to return the list of connected devices it needs to know the list in advance, and there's a dependency on any functional API, like a colorSensor.color to know that there is a color sensor connected on port X, otherwise it won't call the VM. and in turn won't call the sim methods (that could potentially indicate to us that theres a color sensor on port X)
from pxt-ev3.
I guess we can always return a CONN_INPUT_UART. Except touch is not uart, so donno how we'll detect that.
from pxt-ev3.
When the code calls “colorSensor.color”, it registers the device state and returns the default value. Later on the device gets polled and UartSensor picks up the value.
So it might be that the first read returns the default value.
from pxt-ev3.
Figured it out. Added a method in the cpp (motorUsed and sensorUsed) and in the constructor of every Sensor and Motor I call markUsed.
markUsed is in turn implemented in the simulator and is a NOP in the cpp. Seems to work :)
from pxt-ev3.
How do you handle collisions?
from pxt-ev3.
Not sure yet. but we'll need to figure out some clever way to do so. At least we now have all the information.
from pxt-ev3.
from pxt-ev3.
Yeah, although unlikely, the common scenario is to use event handlers and different ports. All the logic is in the sim, so we can certainly have a timestamp associated with registration and perhaps have a "smarter" way to tell which of two colliding inputs / outputs to discard.
from pxt-ev3.
from pxt-ev3.
Okay. Can do.
from pxt-ev3.
This is all in sim, so perhaps we can even handle it in some nice way. Pop up a message or something.
from pxt-ev3.
from pxt-ev3.
Yup! thanks!
from pxt-ev3.
Related Issues (20)
- I2C sensor starts working only after reconnection HOT 1
- Today's problems HOT 6
- Rump control HOT 1
- Transferring Makecode Simulator data over com port HOT 1
- This repo is missing important files
- Tilt Angle Gyro Sensor HOT 4
- Somtimes, I can't run the xx.py file in ev3 HOT 3
- Unable to build and deploy HOT 3
- No icons displayed when categories are translated
- Cannot reliably mount emulated storage under Linux HOT 6
- There is no way to switch the type of engines HOT 5
- Compilation error when using the "storage" extension in beta HOT 1
- Can't copy the lego-test.uf2 files to the EV3 without it crashing.
- Functionality for using beacons as beacons HOT 1
- showPorts riding over console.sendToScreen();
- Can't put an angle with decimal point into a protractor HOT 2
- EV3 Brick not saving files from MakeCode!
- The reversing motor shows the encoder value with minus HOT 2
- Folder for saving the project in EV3 HOT 2
- Bluetooth does not work HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pxt-ev3.