gracenote sdk for music id not working on iOS 7 device - gracenote

here is what we have done:
we added the framework to our project and
have the following in one of our classes:
GCSearchViewController.h
#interface GCSearchViewController : UIViewController<UISearchBarDelegate, GNSearchResultReady, GNAudioSourceDelegate>
GCSearchViewController.m
// - As per the web tutorial
#import <GracenoteMusicID/GNConfig.h>
#import <GracenoteMusicID/GNOperations.h>
#import <GracenoteMusicID/GNSearchResponse.h>
#import <GracenoteMusicID/GNSearchResult.h>
// - As per what we saw in the demo app
#import <GracenoteMusicID/GNRecognizeStream.h>
#import <GracenoteMusicID/GNAudioConfig.h>
#import <GracenoteMusicID/GNAudioSourceMic.h>
#import <AVFoundation/AVAudioSession.h>
…
#pragma mark - Gracenote Delegate
-(void) identifySong {
[[AVAudioSession sharedInstance] requestRecordPermission:^(BOOL response){
NSLog(#"Allow microphone use response: %d", response);
if (response) {
[GNOperations recognizeMIDStreamFromMic:self config:self.config];
}
}];
}
- (void) GNResultReady:(GNSearchResult *) result
{
GNSearchResponse *best = [result bestResponse];
if (![result isFailure] && (best.artist!=nil)) {
NSLog(#"Artist %#", best.artist);
NSLog(#"Song name %#", best.trackTitle);
} else {
NSLog(#"No Match");
}
}
- (void) audioBufferDidBecomeReady:(GNAudioSource*)audioSource samples:(NSData*)samples {
NSError *err;
err = [self.recognizeFromPCM writeBytes:samples];
if (err) {
NSLog(#"ERROR: %#",[err localizedDescription]);
}
}
this code works ok in the simulator, but whenever we run it on the device (ipod touch 5th or iphone 5) the app breaks with the following error:
2013-11-16 22:00:40.402 GC[1758:60b] 22:00:40.401 ERROR: [0x3c29f18c] >aurioc> 783: failed: -10851 (enable 1, outf< 2 ch, 0 Hz, Float32, non-inter> inf< 1 ch, 44100 Hz, Int16>)
Error: 0xffffd59d2013-11-16 22:00:52.904 Leaf[1758:60b] Allow microphone use response: 1
2013-11-16 22:00:52.925 GC[1758:60b] 22:00:52.925 ERROR: [0x3c29f18c] >aurioc> 783: failed: -10851 (enable 1, outf< 2 ch, 0 Hz, Float32, non-inter> inf< 1 ch, 44100 Hz, Int16>)
Error: 0xffffd59d2013-11-16 22:00:52.927 GC[1758:60b] *** Assertion failure in -[GNFingerprinterQueue startupTimerFired], /home/mobile/z-15003-ecma-3.2/cddb-clients/mmid/iOSMobileSDK/3.2/Classes/Private/GNFingerprinterQueue.m:291
2013-11-16 22:00:52.930 GC[1758:60b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'audioSource is nil'
*** First throw call stack:
(0x2fb66f4b 0x39e7b6af 0x2fb66e25 0x3050efe3 0x151849 0x1520e5 0x3054ae9b 0x2fb32183 0x2fb31653 0x2fb2fe47 0x2fa9ac27 0x2fa9aa0b 0x3478a283 0x3233e049 0x7b621 0x3a383ab7)
libc++abi.dylib: terminating with uncaught exception of type NSException
our app is targeting iOS7... appreciate any pointers on how to make it work

This is an error with acquiring the Microphone hardware. The error log:
2013-11-16 22:00:40.402 GC[1758:60b] 22:00:40.401 ERROR: [0x3c29f18c] >aurioc> 783: failed: -10851 (enable 1, outf< 2 ch, 0 Hz, Float32, non-inter> inf< 1 ch, 44100 Hz, Int16>)
Above error happens in two cases:
Microphone Hardware was not configured correctly OR
RemoteIO was unable to acquire hardware.
This is typically happens with Simulator but can happen on the device if the microphone is inaccessible. The error can also happen if AVAudioSession is not correctly configured or is messed up. Check AVAudioSession configuration and Try deleting the iOS app, re-installing it and doing a clean build.

Related

ESP32 Unable to send Telegram message in interrupt method

I'm working on my first ESP32 project using a DFRobot Firebeetle 2 (ESP32-WROOM-32E) and the Arduino IDE (configured as per DFRobot's instructions). I'm trying creating a Telegram bot which will send a message when the temperature exceeds a certain value. This part is working in the loop() method, but now I'm trying to add a 'status button' which triggers an interrupt to send a status message. I plan to use the ESP32's sleep function, hence using an interrupt rather than checking the button in loop() - I am aware that loop() doesn't execute when using sleep. The problem is sending a message in the interrupt method is causing an error, but I don't know how to resolve it.
If I reduce minStatusMsgInterval to 250 and call SendStatusMessage(); at the end of setup() I receive the message, so the function works, just not when it's called from an interrupt. The error mentions wdt timeout so I'm thinking bot.sendMessage() is taking too long? But if that is the case, I can't make it any quicker, so is there another way to achieve this? or have I misinterpreted the error completely?
#include <WiFi.h>
#include "WiFiClientSecure.h"
#include <ESP32Time.h>
#include <DFRobot_DHT11.h>
#include <UniversalTelegramBot.h>
//WiFi
#define WLAN_SSID "ESP32Test"
#define WLAN_PASS "*********"
//WiFiFlientSecure for SSL/TLS support
WiFiClientSecure client;
//Time
ESP32Time rtc(0); // offset in seconds; 0 = GMT, 3600 = GMT+1
//Telegram
#define TELEGRAM_TOKEN "*********:*************************"
#define CHAT_ID "**********"
UniversalTelegramBot bot(TELEGRAM_TOKEN, client);
//Temperature
DFRobot_DHT11 DHT;
#define DHT11_PIN D11
//Buttons
#define ONBOARD_BUTTON_PIN 27 //ESP32 pin 27
#define STATUS_BUTTON_PIN D10 //ESP32 pin 12
int StatusButtonLastInterrupt = 0;
//Alerts
int alertValue = 27;
bool alertSent = false;
int minStatusMsgInterval = 5000;
void IRAM_ATTR SendStatusMessage() {
if (millis() - StatusButtonLastInterrupt < minStatusMsgInterval) return; //Prevent executing multiple times per button press or more frequent than required
String message = "Temperature Monitor Status\n\n";
message += "Internal temperature: " + String(DHT.temperature) + "C\n";
message += "Internal humidity: " + String(DHT.humidity) + "%\n";
//message += "System time: " + rtc.getDateTime(); // Causes ESP to crash and reset. Error: abort() was called at PC 0x40084cf7 on core 1
//TODO: Check WiFi is connected first - will need to connect when woken from sleep
bot.sendMessage(CHAT_ID, message, ""); // Causes ESP to crash and reset. Error: Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1).
StatusButtonLastInterrupt = millis();
}
void SyncNTP() {
Serial.print("Retrieving time: ");
configTime(0, 3600, "time.google.com"); // get UTC time via NTP
time_t now = time(nullptr);
while (now < 24 * 3600)
{
Serial.print(".");
delay(100);
now = time(nullptr);
}
rtc.setTime(now); //Set the time on the realtime clock
Serial.println(rtc.getDateTime());
}
void setup() {
pinMode(ONBOARD_BUTTON_PIN, INPUT_PULLUP);
pinMode(STATUS_BUTTON_PIN, INPUT);
Serial.begin(115200);
//Interrupts
attachInterrupt(STATUS_BUTTON_PIN, SendStatusMessage, FALLING);
// Connect to WiFi access point.
Serial.println(); Serial.println();
Serial.print("Connecting to ");
Serial.println(WLAN_SSID);
WiFi.mode(WIFI_MODE_STA);
WiFi.begin(WLAN_SSID, WLAN_PASS);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
//Serial.print(".");
Serial.print("WiFi Status: ");
Serial.println(WiFi.status());
}
Serial.println();
Serial.println("WiFi connected");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
client.setCACert(TELEGRAM_CERTIFICATE_ROOT); // Add root certificate for api.telegram.org
SyncNTP();
}
void loop() {
DHT.read(DHT11_PIN);
Serial.print("temp:");
Serial.print(DHT.temperature);
Serial.print(" humi:");
Serial.println(DHT.humidity);
if (DHT.temperature >= alertValue)
{
if (!alertSent)
{
bot.sendMessage(CHAT_ID, "TEMPERATURE ALERT: Internal temperature is: " + String(DHT.temperature), "");
alertSent = true;
}
} else {
if (alertSent)
{
bot.sendMessage(CHAT_ID, "Alert Cleared: Internal temperature is: " + String(DHT.temperature), "");
alertSent = false; //Reset the flag when temperature drops below alertValue
}
}
delay(1000);
}
Serial Monitor Output:
Connecting to ESP32Test
WiFi Status: 6
WiFi Status: 6
WiFi Status: 6
WiFi Status: 6
WiFi Status: 3
WiFi connected
IP address: 192.168.1.2
Retrieving time: ....................Sun, Feb 19 2023 22:23:38
temp:25 humi:57
temp:24 humi:53
temp:24 humi:60
temp:24 humi:60
temp:24 humi:60
temp:24 humi:60
Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1).
Core 1 register dump:
PC : 0x40090362 PS : 0x00060f34 A0 : 0x8008f47e A1 : 0x3ffbeb00
A2 : 0x3ffde700 A3 : 0x3ffbd994 A4 : 0x00000004 A5 : 0xb33fffff
A6 : 0x00000001 A7 : 0x00000001 A8 : 0x3ffbd994 A9 : 0x3ffbd994
A10 : 0x00000019 A11 : 0x00000019 A12 : 0x3ffc3afc A13 : 0xb33fffff
A14 : 0x00000001 A15 : 0x00000001 SAR : 0x0000000f EXCCAUSE: 0x00000006
EXCVADDR: 0x00000000 LBEG : 0x400896b0 LEND : 0x400896c6 LCOUNT : 0xffffffff
Core 1 was running in ISR context:
EPC1 : 0x400e8e33 EPC2 : 0x00000000 EPC3 : 0x00000000 EPC4 : 0x40090362
Backtrace:0x4009035f:0x3ffbeb000x4008f47b:0x3ffbeb20 0x4008de7c:0x3ffbeb40 0x40106ab7:0x3ffbeb80 0x400f408f:0x3ffbeba0 0x401071c5:0x3ffbebd0 0x40107464:0x3ffbebf0 0x400f379d:0x3ffbec40 0x400d49d2:0x3ffbec60 0x400d472d:0x3ffbeed0 0x400d483e:0x3ffbef00 0x400d6c31:0x3ffbef20 0x400d7ece:0x3ffbef80 0x400d8406:0x3ffbf000 0x4008139e:0x3ffbf070 0x400d93f5:0x3ffbf0d0 0x40084a8d:0x3ffbf0f0 0x40173c7f:0x3ffc78f0 0x400e82e9:0x3ffc7910 0x4008e417:0x3ffc7930
Core 0 register dump:
PC : 0x40090522 PS : 0x00060634 A0 : 0x8008fc1b A1 : 0x3ffb3290
A2 : 0x3ffbf108 A3 : 0x3ffb32ac A4 : 0x00060623 A5 : 0xb33fffff
A6 : 0x0000cdcd A7 : 0x0000abab A8 : 0x0000abab A9 : 0x0000abab
A10 : 0x3ffde770 A11 : 0x000000d0 A12 : 0x3ffc6948 A13 : 0xb33fffff
A14 : 0x00000001 A15 : 0x00000001 SAR : 0x00000011 EXCCAUSE: 0x00000006
EXCVADDR: 0x00000000 LBEG : 0x400896b0 LEND : 0x400896c6 LCOUNT : 0xffffffff
Backtrace:0x4009051f:0x3ffb32900x4008fc18:0x3ffb32d0 0x4008dd9c:0x3ffb32f0 0x401069c0:0x3ffb3330 0x40106d0e:0x3ffb3350 0x400f56bb:0x3ffb3370 0x400f5739:0x3ffb3390 0x400f812c:0x3ffb33b0 0x400f8211:0x3ffb33e0 0x40108557:0x3ffb3400 0x400f3f19:0x3ffb3420
ELF file SHA256: 0000000000000000
Rebooting...
ets Jul 29 2019 12:21:46
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1412
load:0x40078000,len:13400
load:0x40080400,len:3672
entry 0x400805f8
Connecting to ESP32Test
In general, interrupt handlers need to do as little as possible and return as quickly as possible. Doing too much or calling unsafe functions (which almost all functions will be) leads to programs crashing exactly the way you saw.
Interrupts, as the name indicates, interrupt whatever code is running and execute the interrupt's handler. The handler has no idea what state the code that was interrupted is in. It could easily be in an inconsistent state while it's performing a computation; calling it while it's in an inconsistent state is likely to corrupt memory or cause it to crash or behave erratically. Unless software is specifically designed to be called from an interrupt handler you must assume it's not safe to do so.
As you noticed, the ESP32 requires an interrupt handler to be marked with the IRAM_ATTR attribute - this tells the ESP32 to always keep this code in "Instruction RAM" so that it's always available to execute. The ESP32 isn't able to pull code in from flash storage on demand to service an interrupt. That means that not only does the interrupt handler have to be in IRAM, all functions it calls must be as well. IRAM is a scarce resource, so you want to use as little of it as possible - calling Telegram from an interrupt handler means that not only does all of the Telegram code need to be in IRAM but the entire TCP/IP network stack needs to be. Which also means you'd have to modify every single function in the TelegramBot and network stack to be declared IRAM_ATTR.
Obviously that's not going to work.
Unless you really know what you're doing, the safest way to code an interrupt handler is to set a flag variable indicating there's work to be done, store any data that needs to be saved for the work in other variables and return.
In your case it would look something like this:
volatile boolean should_send_telegram_message = false;
void IRAM_ATTR SendStatusMessage() {
if (millis() - StatusButtonLastInterrupt < minStatusMsgInterval)
return; //Prevent executing multiple times per button press or more frequent than required
should_send_telegram_message = true;
}
void loop() {
if(should_send_telegram_message) {
should_send_telegram_message = false;
String message = "Temperature Monitor Status\n\n";
message += "Internal temperature: " + String(DHT.temperature) + "C\n";
message += "Internal humidity: " + String(DHT.humidity) + "%\n";
//message += "System time: " + rtc.getDateTime(); // Causes ESP to crash and reset. Error: abort() was called at PC 0x40084cf7 on core 1
//TODO: Check WiFi is connected first - will need to connect when woken from sleep
bot.sendMessage(CHAT_ID, message, ""); // Causes ESP to crash and reset. Error: Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1).
StatusButtonLastInterrupt = millis();
}
// do other loop() stuff
}
The volatile attribute on should_send_telegram_message tells the compiler that this variable may unexpectedly have its value changed (as the interrupt handler may do) so that the compiler will avoid doing certain optimizations that depend on the variable not unexpectedly changing.

How to save a _flutterFFmpeg gif in firebase storage?

Edit:
After some changes with help from #Frank van Puffelen
I getting a new error see below updated code and updated error
Hello everyone im trying to save a gif which I create with flutter_ffmpeg: ^0.4.2
With this code im trying to create a gif of picked video from user which is currently widget.videopathasstring
THis is the path of picked video.
Directory gifDirectory;
String gifOutputFile;
getpreviewvideo() async {
String currentvideo = widget.videopathasstring;
await getApplicationDocumentsDirectory().then((directory) {
print("13");
gifDirectory = Directory(directory.path + '/gif');
print("14");
gifDirectory.exists().then((exists) async {
print("0");
if (!exists) {
print("1");
await gifDirectory.create();
}
}).then((value) => {
print("3"),
gifOutputFile = gifDirectory.path +
'/' +
DateTime.now().millisecondsSinceEpoch.toString() +
'.gif',
});
});
print("4");
var arguments = [
'-i',
currentvideo,
'-t',
'2.5',
'-ss',
'2.0',
'-f',
'gif',
gifOutputFile,
];
_flutterFFmpeg.executeWithArguments(arguments).then((rc) {
print("FFmpeg process exited with rc $rc");
});
return File(gifOutputFile);
}
The problem is im getting this error
GTMSessionFetcher invoking fetch callbacks, data {length = 0, bytes = 0x}, error (null)
2
GTMSessionFetcher invoking fetch callbacks, data {length = 613, bytes = 0x7b0a2020 226e616d 65223a20 22616c6c ... 36316263 34220a7d }, error (null)
flutter: 13
flutter: 14
flutter: 4
flutter: Invalid argument(s) (path): Must not be null
flutter: 0
-[NSNull length]: unrecognized selector sent to instance 0x1dc5f0558
flutter: 3
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull length]: unrecognized selector sent to instance 0x1dc5f0558'
*** First throw call stack:
(0x181e8904c 0x19a4fdf54 0x181f66014 0x181e1e474 0x181e1d5b0 0x181e15410 0x181e0d0a0 0x100e3c4b8 0x100e3b324 0x100e3bb24 0x10065528c 0x181af9914 0x181afb660 0x181afe788 0x181b0cdd0 0x181b0d5f8 0x1f212a0b8 0x1f2129e94)
libc++abi: terminating with uncaught exception of type NSException
* thread #65, queue = 'com.apple.root.default-qos', stop reason = signal SIGABRT
frame #0: 0x00000001b8cd0964 libsystem_kernel.dylib`__pthread_kill + 8
libsystem_kernel.dylib`__pthread_kill:
-> 0x1b8cd0964 <+8>: b.lo 0x1b8cd0984 ; <+40>
0x1b8cd0968 <+12>: pacibsp
0x1b8cd096c <+16>: stp x29, x30, [sp, #-0x10]!
0x1b8cd0970 <+20>: mov x29, sp
Target 0: (Runner) stopped.
Lost connection to device.
Exited (sigterm)
Hope anyone can help
It seems you're not uploading the file to Cloud Storage, which only happens once you call putFile.
Have a look at the FlutterFire documentation on uploading files for an example of how to use putFile

mbed: HardFault Error when accessing SD-Card after building up network connection

I want to combine a HTTP-Client and a SD-Card-Reader. My goal is to download a file from a server and save that file on the SD-Card. Unfortunately Im stuck on the way, because of an Hard Fault 0x80FF013D.
I haven broken down the code and recognized in summary:
network communication (GET-command) works fine solo
SD-Card access (read and write) works fine solo
SD-Card access works fine before building up the network connection
Hard Fault occures, when I access the SD-Card after building up the network connection
Core-Infos:
OS: MBED OS5
IDE: MBED CLI v1.8.2
MC: NUCLEO-F746ZG
SD-Card Reader: CATALEX MicroSD Card Adapter with Transcend 2GB microSD (FAT formatted)
Libraries:
mbed-os
https://github.com/ARMmbed/mbed-os/#e1bea44212b8275f7d8ce7253e758c2e25c57482
sd-driver https://github.com/ARMmbed/sd-driver/#a8c85d30af86a7431d85dee02d133d60dd386406
Serial Output with HardFault:
[NWKH] Connecting to network...
[NWKH] Connected to the network
[NWKH] IP address: 192.168.188.29
Test SD-Card
++ MbedOS Fault Handler ++
FaultType: HardFault
Context:
R0 : 20000400
R1 : BFF39B82
R2 : 08025B6A
R3 : 00000003
R4 : 00000000
R5 : 2000FA34
R6 : 84551677
R7 : 7FFFFC00
R8 : 00000003
R9 : 08025B6A
R10 : 2000FA34
R11 : 00000000
R12 : 08013E6D
SP : 2000F9F8
LR : 0801A8E7
PC : A0000000
xPSR : 210B0000
PSP : 2000F990
MSP : 2004FFC0
CPUID: 410FC271
HFSR : 40000000
MMFSR: 00000001
BFSR : 00000000
UFSR : 00000000
DFSR : 0000000B
AFSR : 00000000
Mode : Thread
Priv : Privileged
Stack: PSP
-- MbedOS Fault Handler --
++ MbedOS Error Info ++
Error Status: 0x80FF013D Code: 317 Module: 255
Error Message: Fault exception
Location: 0x8012A7B
Error Value: 0xA0000000
Current Thread: Id: 0x2000DA34 Entry: 0x8012BEB StackSize: 0x2000 StackMem: 0x2000DA78 SP: 0x2004FF58
For more info, visit: https://armmbed.github.io/mbedos-error/?error=0x80FF013D
-- MbedOS Error Info --
I have started with the http-example from mbed https://os.mbed.com/teams/sandbox/code/http-example/file/2efadc4d8784/source/main-http-socket-reuse.cpp/shortlog/
and added some stuff from the sd card file system example
https://os.mbed.com/cookbook/SD-Card-File-System
main-http.cpp
#include "select-demo.h"
#if DEMO == DEMO_HTTP
#include "mbed.h"
#include "http_request.h"
#include "network-helper.h"
#include "mbed_mem_trace.h"
#include "SDBlockDevice.h"
#include "FATFileSystem.h"
#include "DebouncedIn.h"
#define SD_MOUNT_PATH "sd"
#define FULL_UPDATE_FILE_PATH "/" SD_MOUNT_PATH "/" MBED_CONF_APP_UPDATE_FILE
SDBlockDevice sd(MBED_CONF_APP_SD_CARD_MOSI, MBED_CONF_APP_SD_CARD_MISO,
MBED_CONF_APP_SD_CARD_SCK, MBED_CONF_APP_SD_CARD_CS);
FATFileSystem fs(SD_MOUNT_PATH);
NetworkInterface* network;
DebouncedIn btn(USER_BUTTON);
FILE* file;
int main()
{
/*------Init SD-Card-----------*/
int r;
//Init
if ((r = sd.init()) != 0) {
printf("Could not initialize SD driver (%d)\n", r);
return 1;
}
//Mount
if ((r = fs.mount(&sd)) != 0) {
printf("Could not mount filesystem, is the SD card formatted as FAT? (%d)\n", r);
return 1;
}
/*------Init Network-----------*/
network = connect_to_default_network_interface();
if (!network)
{
printf("Cannot connect to the network, see serial output\n");
return 1;
}
//Write
printf("Test SD-Card\n");
char testbuffer2[] = { 'a' , 'b' , 'c' };
file = fopen("/sd/test.bin", "wb");
fwrite("abc",1,3,file);
//fwrite(testbuffer2,1,sizeof(testbuffer2),file);
fclose(file);
//Hauptschleife
while(1)
{
//Buttondruck
if (btn.rising())
{
printf("Update wird gesucht, bitte warten\n");
}
}
}
#endif
mbed_app.json
{
"config": {
"main-stack-size": {
"value": 8192
},
"update_file": {
"help": "Path to the application update binary on the SD card",
"value": "\"update.bin\""
},
"sd_card_mosi": {
"help": "MCU pin connected to the SD card's SPI MOSI pin",
"value": "D11"
},
"sd_card_miso": {
"help": "MCU pin connected to the SD card's SPI MISO pin",
"value": "D12"
},
"sd_card_sck": {
"help": "MCU pin connected to the SD card's SPI SCK pin",
"value": "D13"
},
"sd_card_cs": {
"help": "MCU pin connected to the SD card's SPI CS pin",
"value": "D10"
}
},
"macros": [
"MBEDTLS_MPI_MAX_SIZE=1024",
"MBEDTLS_MPI_WINDOW_SIZE=1",
"MBEDTLS_USER_CONFIG_FILE=\"mbedtls_entropy_config.h\"",
"MBEDTLS_TEST_NULL_ENTROPY",
"MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES",
"MBED_HEAP_STATS_ENABLED=1"
],
"target_overrides": {
"*": {
"platform.stdio-baud-rate": 115200,
"platform.stdio-convert-newlines": true,
"mbed-mesh-api.6lowpan-nd-channel-page": 0,
"mbed-mesh-api.6lowpan-nd-channel": 12,
"mbed-trace.enable": 1,
"platform.error-hist-enabled": 1,
"mbed-http.http-buffer-size": 2048,
"nsapi.default-wifi-security": "WPA_WPA2",
"nsapi.default-wifi-ssid": "\"SSID\"",
"nsapi.default-wifi-password": "\"Password\""
}
}
}
I have already read the Tutorial for "Analyzing Mbed OS crash dump" -> https://os.mbed.com/docs/v5.8/tutorials/analyzing-mbed-os-crash-dump.html,
but I have still no idea what I can do, to find the reason for the Hard Fault.
Error Status: "0x80FF013D" means "Hard Fault exception"
HFSR: 40000000 means "Forced Hard Fault"
MMFSR: 00000001 means "The processor attempted an instruction fetch from a location that does not permit execution."
UFSR: 00000000 means "everything is good"
BFSR: 00000000 means "everything is good"
I would appreciate some help. Thanks in advance.
This board has conflict pin D11. It used by ethernet and both your SPI. You need to use another SPI pins or follow guide from mbed site to fix board:
If you use both SPI and Ethernet You have to patch the NUCLEO board on the back side:
remove SB121 and close SB122 solder bridges. This will
connect PB_5 to D11 instead of PA_7.
Overwrite the d11_configuration by using the mbed_app.json file and use PB_5 (instead of PA_7 default value).

Arduino with servo and RTC

I am making a project that involves a RTC and a servo motor so that it only turns on at a certain time. A snippet from the loop is:
void loop() {
DateTime now = rtc.now();
if (DateTime == 19:10) {
//Some stuff
} else {
return();
}
}
and my error is:
Arduino: 1.6.8 (Windows 10), Board: "Arduino/Genuino Uno"
C:\Users\User\Documents\Arduino\Servo_motor\Servo_motor.ino: In function 'void loop()':
Servo_motor:36: error: expected primary-expression before '==' token
if (DateTime == 19:10) {
^
Servo_motor:36: error: expected ')' before ':' token
if (DateTime == 19:10) {
^
Servo_motor:45: error: expected primary-expression before '}' token
}
^
Servo_motor:45: error: return-statement with a value, in function returning 'void' [-fpermissive]
Servo_motor:45: error: expected ';' before '}' token
Multiple libraries were found for "RTClib.h"
Used: C:\Program Files (x86)\Arduino\libraries\RTClib
Not used: C:\Users\User\Documents\Arduino\libraries\arduino_786051
exit status 1
expected primary-expression before '==' token
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
I am really confused. Can someone please help?
I'm going to assume you're using the Adafruit RTClib located here, as this is likely the one accessible from the IDE, or that a tutorial will use. It's also a fork of the other available RTClib, so this answer is likely to pertain to both.
If you check RTClib.h, you will find the publicly available methods for DateTime and all the RTC classes. If you do so, you'll notice that there is no operator== method, and in general this means that you can't use that as a form of comparison.
In order to do what you want, you need to use DateTime.minute() and DateTime.hour() and compare them separately. In your loop block it would look as follows:
void loop() {
DateTime now = rtc.now();
if (now.hour() == 19 && now.minute() == 10) {
//Some stuff
} else {
return;
}
}
However, this has the possibility of running the code in question quite a few times, as this check will succeed every time the loop runs during the minute following the RTC ticking over to 19:10.
It seems you're comparing the the type with a constant (time without quotes).
Dont you mean something like this?
if (now == "19:10") {

Theos tweak: helloworld alert box did not show up

I followed http://brandontreb.com/beginning-jailbroken-ios-development-building-and-deployment
to make a tweak. every thing seems fine and make package install is successfull,
but when my iPhone respring, the "helloworld" box did not show up,
done any one knows how to solve this?
my xcode is 4.6 and sdk5.1 is installed
my iPhone is iOS6.1.2
I set those
export THEOS=/opt/theos/
export SDKVERSION=5.1
export THEOS_DEVICE_IP=192.168.1.101
this is Makefile
export ARCHS=armv7
export TARGET=iphone:5.1
include $(THEOS)/makefiles/common.mk
helloworld_FRAMEWORKS = UIKit
TWEAK_NAME = helloworld
helloworld_FILES = Tweak.xm
include $(THEOS)/makefiles/tweak.mk
and this is Tweak.xm
#import <SpringBoard/SpringBoard.h>
%hook SpringBoard
-(void)applicationDidFinishLaunching:(id)application {
%orig;
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Welcome"
message:#"Hello world"
delegate:nil
cancelButtonTitle:#"123"
otherButtonTitles:nil];
[alert show];
[alert release];
}
%end
I figure it out, the *.plist should be
{ Filter = { Bundles = ( "com.apple.springboard" ); }; }
thanks #H2CO3, i find your comment somewhere else
but after i done successfully with the helloworld tweak.
I hook the fopen using MSHookFunction
and then i meet a linking error
Making all for tweak hw...
Preprocessing Tweak.xm...
Compiling Tweak.xm...
Linking tweak hw...
Undefined symbols for architecture armv7:
"_MSHookFunction", referenced from:
global constructors keyed to Tweak.xm.mmin Tweak.xm.51941273.o
ld: symbol(s) not found for architecture armv7
collect2: ld returned 1 exit status
make[2]: *** [.theos/obj/hw.dylib.ba964c90.unsigned] Error 1
make[1]: *** [internal-library-all_] Error 2
make: *** [hw.all.tweak.variables] Error 2
this is Tweak.xm
#import "substrate.h"
static FILE * (*s_orig_fopen) ( const char * filename, const char * mode );
static FILE * my_fopen ( const char * filename, const char * mode ){
return s_orig_fopen(filename, mode);
}
static void entry(void) __attribute__ ((constructor));
static void entry(void) {
MSHookFunction(fopen, my_fopen, &s_orig_fopen);
}

Resources