What should ESP.restart() exactly do in NodeMCU? - arduino-esp8266

What should ESP.restart() exactly do in NodeMCU? I want to redo my sketch, but after using ESP.restart() I'll get this in the terminal:
ets Jan 8 2013,rst cause:2, boot mode:(1,6)
ets Jan 8 2013,rst cause:4, boot mode:(1,6)
wdt reset
And after that nothing happens. So how can I redo my sketch like using RST button of NodeMCU?

I think ESP.restart() actually turns the device OFF and ON again i.e all your code would be ran all over again starting from the beginning.

Answering my own problem:
A bug in ESP8266 is that after uploading sketch it needs to be restarted by reset button or be powered off and on, otherwise my problem will happen.
so the solution is restarting nodeMCU by reset button after uploading sketch

Related

iOS 11 network change AVPlayer audio streaming bug

Revised Question (based on the now documented AVPlayer bug):
I found a workaround using this code as a base: https://stackoverflow.com/a/25623647/6697755
I found isWWAN flag can be used to check network type
var flags: SCNetworkReachabilityFlags = []
let isCellular = flags.contains(.isWWAN)
It seems to be a pretty reliable check.
So I can now derive a network type change and reboot the player.
...only took me about 80 hours to find this workaround ;|
I ran into the same problem when I updated to iOS 11. I filed a bug at Apple's Bug Reporter and Open Radar - rdar://35270862
I've edited my question with a workaround to resume playback after leaving or entering wifi.
If anyone has any info on how to fix this or exactly why this issue occurred in iOS11 please let us know.

tx6s usbotg device-tree changing on it's own

I have a tx6s-8035 SoC which we integrated into a custom board. We connected an Asix 88772B to the usbotg port and we need it to start in host mode.
We grounded the USBOTG_ID pin and we tought it will start in host mode. It didn't happen unfortunately.
I have investigated the issue and I see a strange behaviour... I wrote dr_mode = host as an extra property into the official device-tree. After that I modified the ci_hdrc_imx driver to print what it got in the device_node and it said "peripheral". I backtraced the problem and when the of_usb_get_dr_mode() function is being invoked the device-tree already contains dr_mode = peripheral.
Any ideas? I just can't imagine what happens there...
p.s.: I double-checked that I'm updating the device-tree in a proper manner.
I found the issue:
The u-boot overrides the 'dr_mode' property with it's 'usbotg' parameter so I had to change the environment variable in u-boot and it works since that.
Maybe it helps others too.

ADB debugging in Android Studio - some basic issues

Ok, I've squeaked by not needing to use ADB in the Studio, since back
in the 'beta' days of AS. (Just lucky, I guess.) But now, I need to
debug a crashing app.
I've gotten this far:
Learned how to put adb.exe on my Window's 'PATH'
(so that it's invokable from cmd-window):
My path-entry was: C:\Users\David\AppData\Local\Android\sdk\platform-tools
Am assuming that 'logcat' lives on Android device (I was incorrectly guessing it lives on the development machine). I'm assuming this, because when I dis-connect
the USB-cable and enter 'adb logcat' is says waiting for device.
Ok, now my (next) issue: When I fire up the app-being-developed, I'm getting
"Unfortunately has stopped"...which I'm assuming is an app-crash.
And, while I'm looking at 'logcat', I can see a stack-trace flow by. But
as I try to scroll-back to read it, logcat keeps dribbling in more data.
So, how do I tell it to shutup...so that I can look at a static copy
of logcat and see what has happened (without more data dribbling in)?
[If there is other beginner related info, beyond this question, feel free to
to add that info...I'm clearly in need of basic 'adb-related' enlightenment.]
TIA.
Cheers...

XNA: I only have 1 supported display mode (800x600)

I'm trying to get my game to automatically set the window size as the correct resolution for the monitor.
For example, my desktop PC is at 1920x1080 resolution, so I want my game to run at 1920x1080 on here, however my laptop is at 1366x768 so I want my game to run at 1366x768 on there, etc.
I've tried so many different things such as GraphicsDevice.Adapter.CurrentDisplayMode.Width/Height, and even printed out the list of GraphicsDevice.Adapter.SupportedDisplayModes and they all tell me that the only display mode supported for me is 800x600. This is surely not the case, because I'm running my Windows 7 at 1920x1080.
So what on earth am I doing wrong? I tried putting this code in the Game1 constructor, the initialiser, I can't figure out why it isn't working properly!
Okay I fixed it. I just realised I was being a little bit stupid in that I forgot to mention this a "MonoGame" application, not a straight forward XNA project... (I didn't think it would make a difference but oh I was wrong)..
As it turns out, MonoGame has a massive bug to do with the graphics devices, and there is supposedly a way to solve it (build from the latest source or something?) but what I did was install the XNA 4.0 Refresh for Visual Studio 2013, and copied all my source code across to a new XNA project as opposed to a MonoGame project.
And hey presto, GraphicsDevice.DisplayMode.Width and Height are now correctly registering as 1920 and 1080 pixels. So now I can carry on with my game FINALLY.
Thanks to all the people that tried to help me solve this issue!
You can set the resolution of your game in the constructor by adjusting the graphics' PreferredBackBufferWidth and PreferredBackBufferHeight:
For example this will produce a game window that's 480x320:
public Game1()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
graphics.PreferredBackBufferHeight = 320;
graphics.PreferredBackBufferWidth = 480;
}
Keep in mind that when in windowed mode your game will (by default) have a title bar which prevents the game window from being as big as your full screen.
This is my method on how to get your maximum supported resolution(and set it, as an example to clarify it):
// in the Initialize method
graphics.PreferredBackBufferWidth = GraphicsDevice.DisplayMode.Width;
graphics.PreferredBackBufferHeight = GraphicsDevice.DisplayMode.Height;
graphics.IsFullScreen = false;
graphics.ApplyChanges(); // <-- not needed in the Game constructor
However, I don't know what you're doing wrong.

audio error in vmware running mac os x

simple synchronous loading of an audio file (.mp3) in a cocos2d app makes my vmware disconnect the sound.
the error is display bottom right, saying 'error in creating sound stream; sound is disconnected'
i read that it might be cause of my vmware's version (mine is 8) but I'm looking for a fix, not to downgrade to another version.
before i get that error, the sound on the system works just fine (youtube, etc)
the exact code im calling is..
[CDSoundEngine setMixerSampleRate: CD_SAMPLE_RATE_MID];
[[CDAudioManager sharedManager] setResignBehavior: kAMRBStopPlay autoHandle:Yes];
soundEngine = [SimpleAudioEngine sharedEngine];
[soundEngine preloadBackgroundMusic:#"somemp3.mp3"];
[soundEngine playBackgroundMusic:#"somemp3.mp3"];
maybe the bit rate is too high .. ?
thanks
There was a problem in the vmware..

Resources